Skip to content

Commit

Permalink
Add char swap and filtering on characters
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyParts committed Feb 12, 2025
1 parent f16704e commit a188f8d
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions frontend/frontend/src/Pages/Char/AccountList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import TableWrapper from "../../Components/Tables/BaseTable/TableWrapper";
import { components } from "../../api/CtApi";
import { getCharacterList } from "../../api/character";
import { createColumnHelper } from "@tanstack/react-table";
import { Badge } from "react-bootstrap";
import { Row, createColumnHelper } from "@tanstack/react-table";
import { Badge, Button } from "react-bootstrap";
import { useQuery } from "react-query";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom";

const AccountList = () => {
const { characterID } = useParams();
Expand Down Expand Up @@ -39,18 +40,34 @@ const AccountList = () => {
) : (
<></>
),
// filterFn: (row: Row<components["schemas"]["AccountStatus"]>, columnId, filterValue) => {
// if (!filterValue) {
// return true;
// } else {
// let rowValue = row.getValue()[id].reduce((p, c) => {
// return p + " " + c.character.character_name;
// }, "");
// return rowValue
// ? rowValue.toLowerCase().includes(filterValue.toLowerCase())
// : false;
// }
// },
filterFn: (row, _, filterValue) => {
if (!filterValue) {
return true;
} else {
let rowValue = row.original?.characters?.reduce((p: any, c: any) => {
return p + " " + c.character.character_name;
}, "");
return rowValue ? rowValue.toLowerCase().includes(filterValue.toLowerCase()) : false;
}
},
}),
columnHelper.accessor("main", {
header: "",
enableColumnFilter: false,
enableSorting: false,
cell: (cell) =>
cell.getValue() ? (
<Link
className="btn btn-info"
to={{
pathname: `audit/r_beta/${cell.getValue().character_id}/`,
}}
>
<i className="fas fa-external-link" aria-hidden="true"></i>
</Link>
) : (
<></>
),
}),
];

Expand Down

1 comment on commit a188f8d

@pvyParts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #132

Please sign in to comment.