mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 06:24:25 +01:00
feat: add user posts / user home column
This commit is contained in:
@@ -13,7 +13,9 @@ import BasicModal from '@/components/modal/BasicModal';
|
||||
import UserList from '@/components/modal/UserList';
|
||||
import Timeline from '@/components/timeline/Timeline';
|
||||
import SafeLink from '@/components/utils/SafeLink';
|
||||
import { createFollowingColumn, createPostsColumn } from '@/core/column';
|
||||
import useConfig from '@/core/useConfig';
|
||||
import { useRequestCommand } from '@/hooks/useCommandBus';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
import { useTranslation } from '@/i18n/useTranslation';
|
||||
import { genericEvent } from '@/nostr/event';
|
||||
@@ -45,7 +47,8 @@ const FollowersCount: Component<{ pubkey: string }> = (props) => {
|
||||
|
||||
const ProfileDisplay: Component<ProfileDisplayProps> = (props) => {
|
||||
const i18n = useTranslation();
|
||||
const { config, addMutedPubkey, removeMutedPubkey, isPubkeyMuted } = useConfig();
|
||||
const { config, addMutedPubkey, removeMutedPubkey, isPubkeyMuted, saveColumn } = useConfig();
|
||||
const request = useRequestCommand();
|
||||
const commands = useCommands();
|
||||
const myPubkey = usePubkey();
|
||||
const { showProfileEdit } = useModalState();
|
||||
@@ -214,6 +217,24 @@ const ProfileDisplay: Component<ProfileDisplayProps> = (props) => {
|
||||
navigator.clipboard.writeText(npub()).catch((err) => window.alert(err));
|
||||
},
|
||||
},
|
||||
{
|
||||
content: () => i18n()('profile.addUserColumn'),
|
||||
onSelect: () => {
|
||||
const columnName = profile()?.name ?? npub();
|
||||
saveColumn(createPostsColumn({ name: columnName, pubkey: props.pubkey }));
|
||||
request({ command: 'moveToLastColumn' }).catch((err) => console.error(err));
|
||||
props.onClose?.();
|
||||
},
|
||||
},
|
||||
{
|
||||
content: () => i18n()('profile.addUserHomeColumn'),
|
||||
onSelect: () => {
|
||||
const columnName = `${i18n()('column.home')} / ${profile()?.name ?? npub()}`;
|
||||
saveColumn(createFollowingColumn({ name: columnName, pubkey: props.pubkey }));
|
||||
request({ command: 'moveToLastColumn' }).catch((err) => console.error(err));
|
||||
props.onClose?.();
|
||||
},
|
||||
},
|
||||
{
|
||||
content: () => (!isMuted() ? i18n()('profile.mute') : i18n()('profile.unmute')),
|
||||
onSelect: () => {
|
||||
|
||||
Reference in New Issue
Block a user