diff --git a/src/components/modal/ProfileDisplay.tsx b/src/components/modal/ProfileDisplay.tsx index 4edacbb..9c154cd 100644 --- a/src/components/modal/ProfileDisplay.tsx +++ b/src/components/modal/ProfileDisplay.tsx @@ -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 = (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 = (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: () => { diff --git a/src/locales/en.ts b/src/locales/en.ts index 9ad82d1..47d0070 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -57,6 +57,8 @@ export default { unmute: 'Unmute', followMyself: 'Follow myself', unfollowMyself: 'Unfollow myself', + addUserColumn: 'Add user column', + addUserHomeColumn: 'Add home column', confirmUnfollow: 'Do you really want to unfollow?', confirmUpdateEvenIfEmpty: stripMargin` Your follow list appears to be empty. diff --git a/src/locales/ja.ts b/src/locales/ja.ts index a5407ff..177505e 100644 --- a/src/locales/ja.ts +++ b/src/locales/ja.ts @@ -56,6 +56,8 @@ export default { unmute: 'ミュート解除', followMyself: '自分をフォロー', unfollowMyself: '自分をフォロー解除', + addUserColumn: 'ユーザカラムを追加', + addUserHomeColumn: 'ホームカラムを追加', confirmUnfollow: '本当にフォロー解除しますか?', confirmUpdateEvenIfEmpty: stripMargin` フォローリストが空のようです。初めてのフォローであれば問題ありません。