|
|
@@ -1,16 +1,15 @@
|
|
|
+import { DetailPageButton } from '@/components/shared/detail-page-button.js';
|
|
|
import { FacetValueChip } from '@/components/shared/facet-value-chip.js';
|
|
|
import { PermissionGuard } from '@/components/shared/permission-guard.js';
|
|
|
import { Button } from '@/components/ui/button.js';
|
|
|
-import { PageActionBar, PageActionBarRight } from '@/framework/layout-engine/page-layout.js';
|
|
|
+import { PageActionBarRight } from '@/framework/layout-engine/page-layout.js';
|
|
|
import { ListPage } from '@/framework/page/list-page.js';
|
|
|
import { Trans } from '@/lib/trans.js';
|
|
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
|
-import { PlusIcon } from 'lucide-react';
|
|
|
-import { facetListDocument, deleteFacetDocument } from './facets.graphql.js';
|
|
|
-
|
|
|
-import { DetailPageButton } from '@/components/shared/detail-page-button.js';
|
|
|
import { ResultOf } from 'gql.tada';
|
|
|
+import { PlusIcon } from 'lucide-react';
|
|
|
import { FacetValuesSheet } from './components/facet-values-sheet.js';
|
|
|
+import { deleteFacetDocument, facetListDocument } from './facets.graphql.js';
|
|
|
|
|
|
export const Route = createFileRoute('/_authenticated/_facets/facets')({
|
|
|
component: FacetListPage,
|
|
|
@@ -33,7 +32,9 @@ function FacetListPage() {
|
|
|
header: () => <Trans>Values</Trans>,
|
|
|
cell: ({ cell }) => {
|
|
|
const value = cell.getValue();
|
|
|
- if (!value) return null;
|
|
|
+ if (!value) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
const list = value as any as ResultOf<
|
|
|
typeof facetListDocument
|
|
|
>['facets']['items'][0]['valueList'];
|
|
|
@@ -56,8 +57,10 @@ function FacetListPage() {
|
|
|
{list.totalItems > 3 ? (
|
|
|
<div>
|
|
|
<Trans>+ {list.totalItems - 3} more</Trans>
|
|
|
- </div>) : <Trans>View values</Trans>
|
|
|
- }
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <Trans>View values</Trans>
|
|
|
+ )}
|
|
|
</FacetValuesSheet>
|
|
|
</div>
|
|
|
);
|
|
|
@@ -79,18 +82,16 @@ function FacetListPage() {
|
|
|
}}
|
|
|
route={Route}
|
|
|
>
|
|
|
- <PageActionBar>
|
|
|
- <PageActionBarRight>
|
|
|
- <PermissionGuard requires={['CreateFacet', 'CreateCatalog']}>
|
|
|
- <Button asChild>
|
|
|
- <Link to="./new">
|
|
|
+ <PageActionBarRight>
|
|
|
+ <PermissionGuard requires={['CreateFacet', 'CreateCatalog']}>
|
|
|
+ <Button asChild>
|
|
|
+ <Link to="./new">
|
|
|
<PlusIcon className="mr-2 h-4 w-4" />
|
|
|
<Trans>New Facet</Trans>
|
|
|
</Link>
|
|
|
- </Button>
|
|
|
- </PermissionGuard>
|
|
|
- </PageActionBarRight>
|
|
|
- </PageActionBar>
|
|
|
+ </Button>
|
|
|
+ </PermissionGuard>
|
|
|
+ </PageActionBarRight>
|
|
|
</ListPage>
|
|
|
);
|
|
|
}
|