Update resources/scripts/components/dashboard/DashboardContainer.tsx

This commit is contained in:
denis 2024-11-03 02:34:32 -05:00
parent da67cd4206
commit 37ec560c98

View file

@ -13,11 +13,14 @@ import useSWR from 'swr';
import { PaginatedResult } from '@/api/http'; import { PaginatedResult } from '@/api/http';
import Pagination from '@/components/elements/Pagination'; import Pagination from '@/components/elements/Pagination';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import BeforeContent from '@/blueprint/components/Dashboard/BeforeContent'; import BeforeContent from '@/blueprint/components/Dashboard/BeforeContent';
import AfterContent from '@/blueprint/components/Dashboard/AfterContent'; import AfterContent from '@/blueprint/components/Dashboard/AfterContent';
export default () => { export default () => {
const { t } = useTranslation('dashboard/index');
const { search } = useLocation(); const { search } = useLocation();
const defaultPage = Number(new URLSearchParams(search).get('page') || '1'); const defaultPage = Number(new URLSearchParams(search).get('page') || '1');
@ -52,12 +55,12 @@ export default () => {
}, [error]); }, [error]);
return ( return (
<PageContentBlock title={'Dashboard'} showFlashKey={'dashboard'}> <PageContentBlock title={t('title')} showFlashKey={'dashboard'}>
<BeforeContent /> <BeforeContent />
{rootAdmin && ( {rootAdmin && (
<div css={tw`mb-2 flex justify-end items-center`}> <div css={tw`mb-2 flex justify-end items-center`}>
<p css={tw`uppercase text-xs text-neutral-400 mr-2`}> <p css={tw`uppercase text-xs text-neutral-400 mr-2`}>
{showOnlyAdmin ? "Showing others' servers" : 'Showing your servers'} {showOnlyAdmin ? t('showing-others-servers') : t('showing-your-servers')}
</p> </p>
<Switch <Switch
name={'show_all_servers'} name={'show_all_servers'}
@ -77,9 +80,7 @@ export default () => {
)) ))
) : ( ) : (
<p css={tw`text-center text-sm text-neutral-400`}> <p css={tw`text-center text-sm text-neutral-400`}>
{showOnlyAdmin {showOnlyAdmin ? t('no-other-servers') : t('no-servers-associated')}
? 'There are no other servers to display.'
: 'There are no servers associated with your account.'}
</p> </p>
) )
} }
@ -88,4 +89,4 @@ export default () => {
<AfterContent /> <AfterContent />
</PageContentBlock> </PageContentBlock>
); );
}; };