Skip to content

Commit df15d42

Browse files
committed
Misc fixes in edit link of problems and problem links in contest page
1 parent 4467500 commit df15d42

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/[orgId]/problems/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ export default function ProblemsPage({
116116
onDelete={handleDelete}
117117
allowDownload={true}
118118
addPage="new"
119-
editPathAttr="id"
119+
editPathAttr="nameId"
120120
rowClickAttr="nameId"
121+
editPathSuffix="edit"
121122
/>
122123
{/*
123124
<Dialog open={isEditorOpen} onOpenChange={setIsEditorOpen}>

mint/generic-listing.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface GenericListingProps<T> {
4949
addPage?: string;
5050
rowClickAttr?: keyof T; // attribute to use for navigation when row is clicked
5151
editPathAttr?: keyof T; // attribute containing the edit path for navigation
52+
editPathSuffix?: string;
5253
}
5354

5455
// For passing to listing, the id should not be null, its just a temporary hack to satisfy typescript
@@ -64,6 +65,7 @@ export function GenericListing<T extends { id: number | undefined }>({
6465
addPage,
6566
rowClickAttr,
6667
editPathAttr,
68+
editPathSuffix,
6769
}: GenericListingProps<T>) {
6870
const router = useRouter();
6971
const [searchTerm, setSearchTerm] = useState("");
@@ -270,7 +272,7 @@ export function GenericListing<T extends { id: number | undefined }>({
270272
onEdit(item);
271273
} else if (editPathAttr && item[editPathAttr]) {
272274
router.push(
273-
`${window.location.pathname}/${String(item[editPathAttr])}`,
275+
`${window.location.pathname}/${String(item[editPathAttr])}/${editPathSuffix}`,
274276
);
275277
}
276278
}}

0 commit comments

Comments
 (0)