Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33051166
D9558.1768424134.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9558.1768424134.diff
View Options
diff --git a/web/chat/chat-thread-list.react.js b/web/chat/chat-thread-list.react.js
--- a/web/chat/chat-thread-list.react.js
+++ b/web/chat/chat-thread-list.react.js
@@ -6,7 +6,10 @@
import AutoSizer from 'react-virtualized-auto-sizer';
import { VariableSizeList } from 'react-window';
+import { useModalContext } from 'lib/components/modal-provider.react.js';
+import genesis from 'lib/facts/genesis.js';
import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { emptyItemText } from 'lib/shared/thread-utils.js';
import ChatThreadListItem from './chat-thread-list-item.react.js';
@@ -15,6 +18,7 @@
import { ThreadListContext } from './thread-list-provider.js';
import BackgroundIllustration from '../assets/background-illustration.react.js';
import Button from '../components/button.react.js';
+import ComposeSubchannelModal from '../modals/threads/create/compose-subchannel-modal.react.js';
import { useSelector } from '../redux/redux-utils.js';
import { useOnClickNewThread } from '../selectors/thread-selectors.js';
@@ -68,6 +72,27 @@
const communityID = useSelector(state => state.communityPickerStore.chat);
+ const communityThreadInfo = useSelector(state => {
+ if (!communityID) {
+ return null;
+ }
+ return threadInfoSelector(state)[communityID];
+ });
+
+ const { pushModal, popModal } = useModalContext();
+
+ const onClickCreateSubchannel = React.useCallback(() => {
+ if (!communityThreadInfo) {
+ return null;
+ }
+ return pushModal(
+ <ComposeSubchannelModal
+ parentThreadInfo={communityThreadInfo}
+ onClose={popModal}
+ />,
+ );
+ }, [popModal, pushModal, communityThreadInfo]);
+
const threadListContainerRef = React.useRef();
const threads = React.useMemo(
@@ -132,9 +157,15 @@
<Button
variant="filled"
disabled={isThreadCreation}
- onClick={onClickNewThread}
+ onClick={
+ !communityID || communityID === genesis.id
+ ? onClickNewThread
+ : onClickCreateSubchannel
+ }
>
- Create new chat
+ {!communityID || communityID === genesis.id
+ ? 'Create new chat'
+ : 'Create new channel'}
</Button>
</div>
</>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 8:55 PM (13 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5933974
Default Alt Text
D9558.1768424134.diff (2 KB)
Attached To
Mode
D9558: [web] Create new chat button creates chat in GENESIS community only
Attached
Detach File
Event Timeline
Log In to Comment