mirror of
https://github.com/zkitter/ui.git
synced 2026-01-09 21:28:05 -05:00
fix: go to group profile when clicking on custom group name (#53)
* fix: go to group profile when clicking on custom group name * fix custom group profile * fix prettier
This commit is contained in:
@@ -40,11 +40,18 @@ export default function ExpandedPost(
|
||||
|
||||
const gotoUserProfile = useCallback(
|
||||
(e: any) => {
|
||||
if (!user || !post?.creator) return;
|
||||
e.stopPropagation();
|
||||
const [protocol, groupAddress] = zkGroup?.split('_') || [];
|
||||
|
||||
if (protocol === 'custom') {
|
||||
history.push(`/${groupAddress}/`);
|
||||
}
|
||||
|
||||
if (!user || post?.type === MessageType._TWEET) return;
|
||||
|
||||
history.push(`/${user?.ens || user?.username}/`);
|
||||
},
|
||||
[user, post]
|
||||
[user, post, zkGroup]
|
||||
);
|
||||
|
||||
if (!post) return <></>;
|
||||
|
||||
@@ -43,11 +43,18 @@ export default function RegularPost(
|
||||
|
||||
const gotoUserProfile = useCallback(
|
||||
(e: any) => {
|
||||
if (!user || post?.type === MessageType._TWEET) return;
|
||||
e.stopPropagation();
|
||||
const [protocol, groupAddress] = zkGroup?.split('_') || [];
|
||||
|
||||
if (protocol === 'custom') {
|
||||
history.push(`/${groupAddress}/`);
|
||||
}
|
||||
|
||||
if (!user || post?.type === MessageType._TWEET) return;
|
||||
|
||||
history.push(`/${user?.ens || user?.username}/`);
|
||||
},
|
||||
[user, post?.type]
|
||||
[user, post?.type, zkGroup]
|
||||
);
|
||||
|
||||
if (!post) return <></>;
|
||||
|
||||
@@ -18,6 +18,7 @@ import { useHistory } from 'react-router';
|
||||
import { useCallback } from 'react';
|
||||
import { EditorState } from 'draft-js';
|
||||
import { convertMarkdownToDraft } from '../components/DraftEditor';
|
||||
import Web3 from 'web3';
|
||||
|
||||
enum ActionTypes {
|
||||
SET_POSTS = 'posts/setPosts',
|
||||
@@ -554,12 +555,18 @@ export const useMeta = (messageId = '') => {
|
||||
export const useZKGroupFromPost = (messageId?: string) => {
|
||||
return useSelector((state: AppRootState): string | undefined => {
|
||||
if (!messageId) return;
|
||||
|
||||
const post = state.posts.meta[messageId];
|
||||
|
||||
if (!post?.interepProvider) return undefined;
|
||||
|
||||
const { interepProvider, interepGroup } = post;
|
||||
|
||||
if (Web3.utils.isAddress(interepProvider)) return `custom_${interepProvider}`;
|
||||
|
||||
return post.interepProvider === 'taz'
|
||||
? 'semaphore_taz_members'
|
||||
: `interrep_${post.interepProvider}_${post.interepGroup}`;
|
||||
: `interrep_${interepProvider}_${interepGroup}`;
|
||||
}, deepEqual);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user