MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / ScriptTable

Function ScriptTable

src/pages/options/routes/ScriptList/ScriptTable.tsx:502–1083  ·  view source on GitHub ↗
({
  loadingList,
  scriptList,
  scriptListSortOrderMove,
  // scriptListSortOrderSwap,
  sidebarOpen,
  setSidebarOpen,
  setViewMode,
  updateScripts,
  setUserConfig,
  setCloudScript,
  handleDelete,
  handleConfig,
  handleRunStop,
}: ScriptTableProps)

Source from the content-addressed store, hash-verified

500}
501
502const ScriptTable = ({
503 loadingList,
504 scriptList,
505 scriptListSortOrderMove,
506 // scriptListSortOrderSwap,
507 sidebarOpen,
508 setSidebarOpen,
509 setViewMode,
510 updateScripts,
511 setUserConfig,
512 setCloudScript,
513 handleDelete,
514 handleConfig,
515 handleRunStop,
516}: ScriptTableProps) => {
517 const { t } = useTranslation();
518 const [showAction, setShowAction] = useState(false);
519 const [action, setAction] = useState("");
520 const [select, setSelect] = useState<Script[]>([]);
521 const [selectColumn, setSelectColumn] = useState(0);
522 const navigate = useNavigate();
523
524 const columns: ColumnProps<ListType>[] = useMemo(
525 () => [
526 {
527 title: "#",
528 dataIndex: "sort",
529 width: 60,
530 key: "#",
531 sorter: (a: ListType, b: ListType) => a.sort - b.sort,
532 render: (col: number) => <SortRender col={col} />,
533 },
534 {
535 key: "title",
536 title: t("enable"),
537 width: t("script_list_enable_width"),
538 dataIndex: "status",
539 className: "script-enable",
540 sorter: (a: ListType, b: ListType) => a.status - b.status,
541 filters: [
542 {
543 text: t("enable"),
544 value: SCRIPT_STATUS_ENABLE,
545 },
546 {
547 text: t("disable"),
548 value: SCRIPT_STATUS_DISABLE,
549 },
550 ],
551 onFilter: (value: any, row: any) => row.status === value,
552 render: (col: any, item: ListType) => <EnableSwitchCell item={item} updateScripts={updateScripts} />,
553 },
554 {
555 key: "name",
556 title: t("name"),
557 dataIndex: "name",
558 sorter: (a: ListType, b: ListType) => a.name.localeCompare(b.name),
559 filterIcon: <IconSearch />,

Callers

nothing calls this directly

Calls 14

pinToTopFunction · 0.90
i18nNameFunction · 0.90
enableActionFunction · 0.85
setWidthByKeyFunction · 0.85
checkByUUIDMethod · 0.80
sortMethod · 0.80
deletesMethod · 0.80
forEachMethod · 0.80
errorMethod · 0.80
exportMethod · 0.45

Tested by

no test coverage detected