Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33074952
D3809.1768447043.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D3809.1768447043.diff
View Options
diff --git a/web/chat/thread-menu.react.js b/web/chat/thread-menu.react.js
--- a/web/chat/thread-menu.react.js
+++ b/web/chat/thread-menu.react.js
@@ -27,6 +27,7 @@
import MenuItem from '../components/menu-item.react';
import Menu from '../components/menu.react';
import SidebarListModal from '../modals/chat/sidebar-list-modal.react';
+import SidebarPromoteModal from '../modals/chat/sidebar-promote-modal.react';
import { useModalContext } from '../modals/modal-provider.react';
import ConfirmLeaveThreadModal from '../modals/threads/confirm-leave-thread-modal.react';
import ThreadMembersModal from '../modals/threads/members/members-modal.react';
@@ -197,16 +198,28 @@
);
}, [onClickLeaveThread, threadInfo]);
+ const onClickPromoteSidebarToThread = React.useCallback(
+ () =>
+ pushModal(
+ <SidebarPromoteModal
+ threadInfo={threadInfo}
+ onClose={popModal}
+ onConfirm={onPromoteSidebar}
+ />,
+ ),
+ [pushModal, threadInfo, popModal, onPromoteSidebar],
+ );
+
const promoteSidebar = React.useMemo(() => {
return (
<MenuItem
key="promote"
text="Promote Thread"
icon="message-square-lines"
- onClick={onPromoteSidebar}
+ onClick={onClickPromoteSidebarToThread}
/>
);
- }, [onPromoteSidebar]);
+ }, [onClickPromoteSidebarToThread]);
const menuItems = React.useMemo(() => {
const notificationsItem = (
diff --git a/web/modals/chat/sidebar-promote-modal.css b/web/modals/chat/sidebar-promote-modal.css
new file mode 100644
--- /dev/null
+++ b/web/modals/chat/sidebar-promote-modal.css
@@ -0,0 +1,16 @@
+div.modal_body {
+ padding: 20px;
+ color: var(--fg);
+ background-color: var(--modal-bg);
+ border-radius: 16px;
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+}
+
+div.buttonContainer {
+ padding-top: 32px;
+ display: flex;
+ gap: 24px;
+ justify-content: flex-end;
+}
diff --git a/web/modals/chat/sidebar-promote-modal.react.js b/web/modals/chat/sidebar-promote-modal.react.js
new file mode 100644
--- /dev/null
+++ b/web/modals/chat/sidebar-promote-modal.react.js
@@ -0,0 +1,49 @@
+// @flow
+
+import * as React from 'react';
+
+import type { ThreadInfo } from 'lib/types/thread-types';
+
+import Button from '../../components/button.react';
+import Modal from '../modal.react';
+import css from './sidebar-promote-modal.css';
+
+type Props = {
+ +onClose: () => void,
+ +onConfirm: () => void,
+ +threadInfo: ThreadInfo,
+};
+
+function SidebarPromoteModal(props: Props): React.Node {
+ const { threadInfo, onClose, onConfirm } = props;
+ const { uiName } = threadInfo;
+
+ const handleConfirm = React.useCallback(() => {
+ onConfirm();
+ onClose();
+ }, [onClose, onConfirm]);
+
+ return (
+ <Modal
+ size="large"
+ name="Promote Thread"
+ icon="warning-circle"
+ onClose={onClose}
+ >
+ <div className={css.modal_body}>
+ <p>{`Are you sure you want to promote "${uiName}"?`}</p>
+ <p>Promoting a sidebar to a full thread cannot be undone.</p>
+ <div className={css.buttonContainer}>
+ <Button onClick={onClose} type="submit" variant="secondary">
+ Cancel
+ </Button>
+ <Button onClick={handleConfirm} type="submit" variant="danger">
+ Promote to Full Thread
+ </Button>
+ </div>
+ </div>
+ </Modal>
+ );
+}
+
+export default SidebarPromoteModal;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 3:17 AM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5935651
Default Alt Text
D3809.1768447043.diff (3 KB)
Attached To
Mode
D3809: [web] [feat] [ENG-991] add modal prompt
Attached
Detach File
Event Timeline
Log In to Comment