Path: blob/master/src/packages/frontend/chat/thread-resolve-button.tsx
14422 views
/*1* This file is part of CoCalc: Copyright © 2020-2026 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6"Resolve" affordance shown next to the ThreadAnchorButton at the top of7an anchored thread's side chat. Mirrors the inline marker-tail check so8the user doesn't have to find the marker in the source first.910Editor-agnostic at the UI level: only renders when the host editor11exposes `resolveChatMarker(hash)` (currently only LaTeX); other editors12can ignore this and the button silently hides.13*/1415import { Button, Popconfirm, Tooltip } from "antd";1617import { Icon } from "@cocalc/frontend/components";18import { COLORS } from "@cocalc/util/theme";1920import type { ChatActions } from "./actions";2122interface Props {23anchorId: string;24actions: ChatActions;25}2627const BUTTON_STYLE = {28// Match the green of the inline tail's check icon so the visual ties29// these two entry points together as the "resolve" action.30background: COLORS.BS_GREEN_LL,31borderColor: COLORS.ANTD_GREEN,32color: COLORS.BS_GREEN_D,33} as const;3435export function ThreadResolveButton({ anchorId, actions }: Props) {36const editorActions = actions.frameTreeActions as any;37if (38editorActions == null ||39typeof editorActions.resolveChatMarker !== "function"40) {41return null;42}43return (44<Popconfirm45title="Resolve chat and remove marker?"46description={47<div style={{ maxWidth: 320 }}>48Marks the chat thread as <b>resolved</b> and removes every{" "}49<code>% chat: …</code> marker from all files. The thread is kept in{" "}50<code>.sage-chat</code> as a read-only archive.51</div>52}53okText="Resolve"54cancelText="Cancel"55onConfirm={() => {56void editorActions.resolveChatMarker(anchorId);57}}58placement="bottomRight"59>60<Tooltip title="Resolve this chat (mark TODO done) and remove its markers">61<Button style={BUTTON_STYLE} icon={<Icon name="check-circle" />} />62</Tooltip>63</Popconfirm>64);65}666768