mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 22:44:26 +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 UserList from '@/components/modal/UserList';
|
||||||
import Timeline from '@/components/timeline/Timeline';
|
import Timeline from '@/components/timeline/Timeline';
|
||||||
import SafeLink from '@/components/utils/SafeLink';
|
import SafeLink from '@/components/utils/SafeLink';
|
||||||
|
import { createFollowingColumn, createPostsColumn } from '@/core/column';
|
||||||
import useConfig from '@/core/useConfig';
|
import useConfig from '@/core/useConfig';
|
||||||
|
import { useRequestCommand } from '@/hooks/useCommandBus';
|
||||||
import useModalState from '@/hooks/useModalState';
|
import useModalState from '@/hooks/useModalState';
|
||||||
import { useTranslation } from '@/i18n/useTranslation';
|
import { useTranslation } from '@/i18n/useTranslation';
|
||||||
import { genericEvent } from '@/nostr/event';
|
import { genericEvent } from '@/nostr/event';
|
||||||
@@ -45,7 +47,8 @@ const FollowersCount: Component<{ pubkey: string }> = (props) => {
|
|||||||
|
|
||||||
const ProfileDisplay: Component<ProfileDisplayProps> = (props) => {
|
const ProfileDisplay: Component<ProfileDisplayProps> = (props) => {
|
||||||
const i18n = useTranslation();
|
const i18n = useTranslation();
|
||||||
const { config, addMutedPubkey, removeMutedPubkey, isPubkeyMuted } = useConfig();
|
const { config, addMutedPubkey, removeMutedPubkey, isPubkeyMuted, saveColumn } = useConfig();
|
||||||
|
const request = useRequestCommand();
|
||||||
const commands = useCommands();
|
const commands = useCommands();
|
||||||
const myPubkey = usePubkey();
|
const myPubkey = usePubkey();
|
||||||
const { showProfileEdit } = useModalState();
|
const { showProfileEdit } = useModalState();
|
||||||
@@ -214,6 +217,24 @@ const ProfileDisplay: Component<ProfileDisplayProps> = (props) => {
|
|||||||
navigator.clipboard.writeText(npub()).catch((err) => window.alert(err));
|
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')),
|
content: () => (!isMuted() ? i18n()('profile.mute') : i18n()('profile.unmute')),
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ export default {
|
|||||||
unmute: 'Unmute',
|
unmute: 'Unmute',
|
||||||
followMyself: 'Follow myself',
|
followMyself: 'Follow myself',
|
||||||
unfollowMyself: 'Unfollow myself',
|
unfollowMyself: 'Unfollow myself',
|
||||||
|
addUserColumn: 'Add user column',
|
||||||
|
addUserHomeColumn: 'Add home column',
|
||||||
confirmUnfollow: 'Do you really want to unfollow?',
|
confirmUnfollow: 'Do you really want to unfollow?',
|
||||||
confirmUpdateEvenIfEmpty: stripMargin`
|
confirmUpdateEvenIfEmpty: stripMargin`
|
||||||
Your follow list appears to be empty.
|
Your follow list appears to be empty.
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ export default {
|
|||||||
unmute: 'ミュート解除',
|
unmute: 'ミュート解除',
|
||||||
followMyself: '自分をフォロー',
|
followMyself: '自分をフォロー',
|
||||||
unfollowMyself: '自分をフォロー解除',
|
unfollowMyself: '自分をフォロー解除',
|
||||||
|
addUserColumn: 'ユーザカラムを追加',
|
||||||
|
addUserHomeColumn: 'ホームカラムを追加',
|
||||||
confirmUnfollow: '本当にフォロー解除しますか?',
|
confirmUnfollow: '本当にフォロー解除しますか?',
|
||||||
confirmUpdateEvenIfEmpty: stripMargin`
|
confirmUpdateEvenIfEmpty: stripMargin`
|
||||||
フォローリストが空のようです。初めてのフォローであれば問題ありません。
|
フォローリストが空のようです。初めてのフォローであれば問題ありません。
|
||||||
|
|||||||
Reference in New Issue
Block a user