mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(web): add Syntaxes column
This commit is contained in:
parent
321bcf210b
commit
0aea9a9bf5
2 changed files with 24 additions and 0 deletions
|
|
@ -14,6 +14,27 @@ export const columns = [
|
|||
columnHelper.accessor((row) => row.description, {
|
||||
header: "Description",
|
||||
}),
|
||||
columnHelper.accessor((row) => row.syntaxIds, {
|
||||
header: "Syntaxes",
|
||||
cell: (info) => {
|
||||
const meta = info.table.options.meta as FilterListsTableMeta;
|
||||
const syntaxes =
|
||||
info.getValue()?.flatMap((id) => {
|
||||
const syntax = meta.syntaxes.find((s) => s.id === id);
|
||||
return syntax
|
||||
? [
|
||||
{
|
||||
key: syntax.id,
|
||||
value: syntax.name,
|
||||
tooltip: syntax.description ?? undefined,
|
||||
href: syntax.url ?? undefined,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
}) ?? [];
|
||||
return <BadgeCloud items={syntaxes} />;
|
||||
},
|
||||
}),
|
||||
columnHelper.accessor((row) => row.languageIds, {
|
||||
header: "Languages",
|
||||
cell: (info) => {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import { Tag } from "@/services/get-tags";
|
|||
export interface FilterListsTableMeta extends TableMeta<FilterList> {
|
||||
languages: readonly Language[];
|
||||
licenses: readonly License[];
|
||||
syntaxes: readonly Syntax[];
|
||||
}
|
||||
|
||||
type FilterListTableProps = {
|
||||
|
|
@ -48,6 +49,7 @@ export function FilterListTable({
|
|||
initialFilterLists,
|
||||
languages,
|
||||
licenses,
|
||||
syntaxes,
|
||||
}: FilterListTableProps) {
|
||||
const [data, setData] = useState<FilterList[]>(initialFilterLists);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
|
@ -71,6 +73,7 @@ export function FilterListTable({
|
|||
meta: {
|
||||
languages,
|
||||
licenses,
|
||||
syntaxes,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue