Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions desktop/src/app/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ export function AppShell() {
<AppShellProvider
value={{
markChannelRead,
markChannelUnread,
openChannelManagement: () => {
setIsChannelManagementOpen(true);
},
Expand Down
5 changes: 5 additions & 0 deletions desktop/src/app/AppShellContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ type AppShellContextValue = {
channelId: string,
readAt: string | null | undefined,
) => void;
markChannelUnread: (
channelId: string,
lastMessageAt: string | null | undefined,
) => void;
openChannelManagement: () => void;
};

const AppShellContext = React.createContext<AppShellContextValue>({
markChannelRead: () => {},
markChannelUnread: () => {},
openChannelManagement: () => {},
});

Expand Down
4 changes: 4 additions & 0 deletions desktop/src/features/channels/ui/ChannelPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type ChannelPaneProps = {
onDelete?: (message: TimelineMessage) => void;
onEdit?: (message: TimelineMessage) => void;
onEditSave?: (content: string) => Promise<void>;
onMarkUnread?: (message: TimelineMessage) => void;
onExpandThreadReplies: (message: TimelineMessage) => void;
onJoinChannel?: () => Promise<void>;
onOpenAgentSession: (pubkey: string) => void;
Expand Down Expand Up @@ -144,6 +145,7 @@ export const ChannelPane = React.memo(function ChannelPane({
onDelete,
onEdit,
onEditSave,
onMarkUnread,
onExpandThreadReplies,
onJoinChannel,
onOpenAgentSession,
Expand Down Expand Up @@ -339,6 +341,7 @@ export const ChannelPane = React.memo(function ChannelPane({
messages={messages}
onDelete={onDelete}
onEdit={onEdit}
onMarkUnread={onMarkUnread}
onReply={activeChannel?.archivedAt ? undefined : onOpenThread}
onTargetReached={onTargetReached}
onToggleReaction={onToggleReaction}
Expand Down Expand Up @@ -444,6 +447,7 @@ export const ChannelPane = React.memo(function ChannelPane({
onDelete={onDelete}
onEdit={onEdit}
onEditSave={onEditSave}
onMarkUnread={onMarkUnread}
onExpandReplies={onExpandThreadReplies}
onSelectReplyTarget={onSelectThreadReplyTarget}
onSend={onSendThreadReply}
Expand Down
15 changes: 14 additions & 1 deletion desktop/src/features/channels/ui/ChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
formatTimelineMessages,
} from "@/features/messages/lib/formatTimelineMessages";
import { buildThreadPanelData } from "@/features/messages/lib/threadPanel";
import type { TimelineMessage } from "@/features/messages/types";
import { useFetchOlderMessages } from "@/features/messages/useFetchOlderMessages";
import { useLoadMissingAncestors } from "@/features/messages/useLoadMissingAncestors";
import { useChannelTyping } from "@/features/messages/useChannelTyping";
Expand Down Expand Up @@ -78,7 +79,8 @@ export function ChannelScreen({
targetMessageEvent,
targetMessageId,
}: ChannelScreenProps) {
const { markChannelRead, openChannelManagement } = useAppShell();
const { markChannelRead, markChannelUnread, openChannelManagement } =
useAppShell();
const [profilePanelPubkey, setProfilePanelPubkey] = React.useState<
string | null
>(null);
Expand Down Expand Up @@ -330,6 +332,16 @@ export function ChannelScreen({
: undefined,
[activeChannel, handleToggleReaction],
);

const handleMarkUnread = React.useCallback(
(message: TimelineMessage) => {
if (!activeChannelId) return;
const messageIso = new Date(message.createdAt * 1_000).toISOString();
markChannelUnread(activeChannelId, messageIso);
},
[activeChannelId, markChannelUnread],
);

const {
channelAgentSessionAgents,
closeAgentSession: handleCloseAgentSession,
Expand Down Expand Up @@ -477,6 +489,7 @@ export function ChannelScreen({
onEditSave={
activeChannel?.archivedAt ? undefined : handleEditSave
}
onMarkUnread={handleMarkUnread}
onExpandThreadReplies={handleExpandThreadReplies}
onOpenAgentSession={handleOpenAgentSession}
onOpenDm={handleOpenDm}
Expand Down
Loading
Loading