pl-fe: types?

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-12-20 14:46:16 +01:00
parent 4db9b4a7e7
commit 747d99acd0
14 changed files with 19 additions and 19 deletions

View File

@@ -257,7 +257,7 @@ const SidebarNavigation: React.FC<ISidebarNavigation> = React.memo(({ shrink })
{features.chats && (
<SidebarNavigationLink
to='/chats'
to='/chats/{-$chatId}'
icon={require('@phosphor-icons/core/regular/chats-teardrop.svg')}
activeIcon={require('@phosphor-icons/core/fill/chats-teardrop-fill.svg')}
count={unreadChatsCount}

View File

@@ -678,7 +678,7 @@ const MenuButton: React.FC<IMenuButton> = ({
const account = status.account;
getOrCreateChatByAccountId(account.id)
.then((chat) => navigate({ to: '/chats/$chatId', params: { chatId: chat.id } }))
.then((chat) => navigate({ to: '/chats/{-$chatId}', params: { chatId: chat.id } }))
.catch(() => {});
};
@@ -1027,7 +1027,7 @@ const MenuButton: React.FC<IMenuButton> = ({
const isGroupAdmin = groupRelationship?.role === GroupRoles.ADMIN;
// const isStatusFromOwner = group.owner.id === account.id;
const canBanUser = match?.isExact && (isGroupOwner || isGroupAdmin) && !ownAccount;
const canBanUser = match && (isGroupOwner || isGroupAdmin) && !ownAccount;
const canDeleteStatus = !ownAccount && (isGroupOwner || isGroupAdmin);
if (canBanUser || canDeleteStatus) {

View File

@@ -120,7 +120,7 @@ const ThumbNavigation: React.FC = React.memo((): JSX.Element => {
src={require('@phosphor-icons/core/regular/chats-teardrop.svg')}
activeSrc={require('@phosphor-icons/core/fill/chats-teardrop-fill.svg')}
text={intl.formatMessage(messages.chats)}
to='/chats'
to='/chats/{-$chatId}'
exact
count={unreadChatsCount}
countMax={9}

View File

@@ -8,7 +8,7 @@ import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config';
import { Card, CardBody, CardHeader, CardTitle, type CardSizes } from './card';
type IColumnHeader = Pick<IColumn, 'label' | 'backHref' | 'className' | 'action'>;
type IColumnHeader = Pick<IColumn, 'label' | 'backHref' | 'backParams' | 'className' | 'action'>;
/** Contains the column title with optional back button. */
const ColumnHeader: React.FC<IColumnHeader> = ({ label, backHref, backParams, className, action }) => {

View File

@@ -170,7 +170,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
toast.error(data?.error);
},
onSuccess: (response) => {
navigate({ to: '/chats/$chatId', params: { chatId: response.id } });
navigate({ to: '/chats/{-$chatId}', params: { chatId: response.id } });
queryClient.invalidateQueries({
queryKey: ['chats', 'search'],
});

View File

@@ -59,7 +59,7 @@ const ChatListItem: React.FC<IChatListItemInterface> = ({ chat, onClick }) => {
deleteChat.mutate(undefined, {
onSuccess() {
if (isUsingMainChatPage) {
navigate({ to: '/chats' });
navigate({ to: '/chats/{-$chatId}' });
}
},
});

View File

@@ -83,7 +83,7 @@ const ChatPageMain = () => {
onConfirm: () => {
deleteChat.mutate(undefined, {
onSuccess() {
navigate({ to: '/chats' });
navigate({ to: '/chats/{-$chatId}' });
},
});
},
@@ -128,17 +128,17 @@ const ChatPageMain = () => {
<IconButton
src={require('@phosphor-icons/core/regular/arrow-left.svg')}
className='mr-2 size-7 sm:mr-0 sm:hidden rtl:rotate-180'
onClick={() => navigate({ to: '/chats' })}
onClick={() => navigate({ to: '/chats/{-$chatId}' })}
/>
<Link to='@{$username}' params={{ username: chat.account.acct }}>
<Link to='/@{$username}' params={{ username: chat.account.acct }}>
<Avatar src={chat.account.avatar} alt={chat.account.avatar_description} size={40} className='flex-none' isCat={chat.account.is_cat} username={chat.account.username} />
</Link>
</HStack>
<Stack alignItems='start' className='h-11 overflow-hidden'>
<div className='flex w-full grow items-center space-x-1'>
<Link to='@{$username}' params={{ username: chat.account.acct }}>
<Link to='/@{$username}' params={{ username: chat.account.acct }}>
<Text weight='bold' size='sm' align='left' truncate>
{chat.account.display_name || `@${chat.account.username}`}
</Text>

View File

@@ -28,7 +28,7 @@ const ChatPageNew: React.FC<IChatPageNew> = () => {
<IconButton
src={require('@phosphor-icons/core/regular/arrow-left.svg')}
className='mr-2 size-7 sm:mr-0 sm:hidden rtl:rotate-180'
onClick={() => navigate({ to: '/chats' })}
onClick={() => navigate({ to: '/chats/{-$chatId}' })}
/>
<CardTitle title={intl.formatMessage(messages.title)} />

View File

@@ -58,7 +58,7 @@ const ChatPageSettings = () => {
<IconButton
src={require('@phosphor-icons/core/regular/arrow-left.svg')}
className='mr-2 size-7 sm:mr-0 sm:hidden rtl:rotate-180'
onClick={() => navigate({ to: '/chats' })}
onClick={() => navigate({ to: '/chats/{-$chatId}' })}
/>
<CardTitle title={intl.formatMessage(messages.title)} />

View File

@@ -25,7 +25,7 @@ const ChatPageShoutbox = () => {
<IconButton
src={require('@phosphor-icons/core/regular/arrow-left.svg')}
className='mr-2 size-7 sm:mr-0 sm:hidden rtl:rotate-180'
onClick={() => navigate({ to: '/chats' })}
onClick={() => navigate({ to: '/chats/{-$chatId}' })}
/>
<Avatar src={logo} alt='' size={40} className='flex-none' />

View File

@@ -23,7 +23,7 @@ const ChatPageSidebar = () => {
if (chat === 'shoutbox') {
navigate({ to: '/chats/shoutbox' });
} else {
navigate({ to: '/chats/$chatId', params: { chatId: chat.id } });
navigate({ to: '/chats/{-$chatId}', params: { chatId: chat.id } });
}
};

View File

@@ -53,7 +53,7 @@ const ChatSearch: React.FC<IChatSearch> = ({ isMainPage = false }) => {
},
onSuccess: (response) => {
if (isMainPage) {
navigate({ to: '/chats/$chatId', params: { chatId: response.id } });
navigate({ to: '/chats/{-$chatId}', params: { chatId: response.id } });
} else {
changeScreen(ChatWidgetScreens.CHAT, response.id);
}

View File

@@ -175,7 +175,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
const handleChatClick = () => {
getOrCreateChatByAccountId(account.id)
.then((chat) => navigate({ to: '/chats/$chatId', params: { chatId: chat.id } }))
.then((chat) => navigate({ to: '/chats/{-$chatId}', params: { chatId: chat.id } }))
.catch(() => {});
};

View File

@@ -230,7 +230,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = React.memo(({ chil
<Redirect from='/user-settings' to='/settings/profile' />
<WrappedRoute path='/notice/:statusId' publicRoute exact layout={DefaultLayout} component={Status} content={children} />
<Redirect from='/users/:username/statuses/:statusId' to='/@:username/posts/:statusId' />
<Redirect from='/users/:username/chats' to='/chats' />
<Redirect from='/users/:username/chats' to='/chats/{-$chatId}' />
<Redirect from='/users/:username' to='/@:username' />
<Redirect from='/registration' to='/' exact />
@@ -272,7 +272,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = React.memo(({ chil
{features.events && <WrappedRoute path='/events/new' layout={EventsLayout} component={ComposeEvent} content={children} />}
{features.events && <WrappedRoute path='/events' layout={EventsLayout} component={Events} content={children} />}
{features.chats && <WrappedRoute path='/chats' exact layout={ChatsLayout} component={ChatIndex} content={children} />}
{features.chats && <WrappedRoute path='/chats/{-$chatId}' exact layout={ChatsLayout} component={ChatIndex} content={children} />}
{features.chats && <WrappedRoute path='/chats/new' layout={ChatsLayout} component={ChatIndex} content={children} />}
{features.chats && <WrappedRoute path='/chats/settings' layout={ChatsLayout} component={ChatIndex} content={children} />}
{features.shoutbox && <WrappedRoute path='/chats/shoutbox' layout={ChatsLayout} component={ChatIndex} content={children} />}