Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 43 additions & 24 deletions components/pageblocks/ProblemRowReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { TextField } from '@mui/material';
import { Button, Stack, Box } from "@mui/material";
import { Folder as FolderIcon } from '@mui/icons-material';
import { Download as DownloadIcon } from '@mui/icons-material';
import { DragIndicator as DragIndicatorIcon } from '@mui/icons-material';
import { IconButton } from '@mui/material';

import PopoverTooltipClick from '../widgets/PopoverTooltipClick';
import ProblemFilterMenu from '../widgets/ProblemFilterMenu';
Expand All @@ -38,7 +40,7 @@ const COMPLEXITY_CLASS_ORDER = ["P", "NPComplete", "NPHard", "NPIntermediate", "
/**
* Creates an accordion that has a nested autocomplete search bar, as well as an editable problem instance textbox
*/
export default function ProblemRowReact({ url, problemName, setProblemName, problemNameMap, setProblemInstance }) {
export default function ProblemRowReact({ url, problemName, setProblemName, problemNameMap, setProblemInstance, dragHandleProps }) {
const problemInfo = useProblemInfo(url, problemName);
const { problemIndex, reductionGraph } = useProblemIndex(url);
const {
Expand Down Expand Up @@ -166,28 +168,28 @@ export default function ProblemRowReact({ url, problemName, setProblemName, prob
const tip =
problemName
? {
header: problemInfo.problemName ?? "",
formalDef: problemInfo.formalDefinition ?? "",
// It makes description clean
info: problemInfo.problemDefinition ?? "",
classification: [
{ label: "Complexity class", value: problemInfo.complexityClass || "Unclassified" },
],
// Source shown on its own line here
source:
problemInfo.source ||
(Array.isArray(problemInfo.citations) ? problemInfo.citations.join("; ") : "") ||
"",
// Contributors
credit:
Array.isArray(problemInfo.contributors) && problemInfo.contributors.length
? problemInfo.contributors.join(", ")
: "",
// Popover builds Wikipedia URL
componentLink: problemInfo.problemLink || "",
sourceLink: problemInfo.sourceLink || "",
isMathDef: true, // only this file adds the flag
}
header: problemInfo.problemName ?? "",
formalDef: problemInfo.formalDefinition ?? "",
// It makes description clean
info: problemInfo.problemDefinition ?? "",
classification: [
{ label: "Complexity class", value: problemInfo.complexityClass || "Unclassified" },
],
// Source shown on its own line here
source:
problemInfo.source ||
(Array.isArray(problemInfo.citations) ? problemInfo.citations.join("; ") : "") ||
"",
// Contributors
credit:
Array.isArray(problemInfo.contributors) && problemInfo.contributors.length
? problemInfo.contributors.join(", ")
: "",
// Popover builds Wikipedia URL
componentLink: problemInfo.problemLink || "",
sourceLink: problemInfo.sourceLink || "",
isMathDef: true, // only this file adds the flag
}
: TOOLTIP;

return (
Expand Down Expand Up @@ -217,7 +219,24 @@ export default function ProblemRowReact({ url, problemName, setProblemName, prob
setSelectedSolverComplexityBuckets={setSelectedSolverComplexityBuckets}
clearFilters={clearFilters}
/>{" "}
<PopoverTooltipClick toolTip={tip} />
<PopoverTooltipClick toolTip={tip} />
{dragHandleProps && (
<IconButton
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
size="small"
title="Drag to reorder"
sx={{
cursor: 'grab',
color: '#424242',
backgroundColor: '#f5f5f5',
'&:hover': { backgroundColor: '#e0e0e0' },
mr: 1,
}}
>
<DragIndicatorIcon />
</IconButton>
)}
</ProblemSection.Header>

<ProblemSection.Body>
Expand Down
20 changes: 20 additions & 0 deletions components/pageblocks/ReduceToRowReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import 'bootstrap/dist/css/bootstrap.min.css'
import { Card } from 'react-bootstrap'
import { Button } from '@mui/material'
import { Download as DownloadIcon } from '@mui/icons-material';
import { DragIndicator as DragIndicatorIcon } from '@mui/icons-material';
import { IconButton } from '@mui/material';

import { requestReducedInstanceFromPath } from '../redux'
import { useProblemInfo, useReducerInfo } from '../hooks/ProblemProvider'
Expand Down Expand Up @@ -56,6 +58,7 @@ export default function ReduceToRowReact({
setChosenReductionType,
reducedInstance,
setReducedInstance,
dragHandleProps,
}) {
const reduceToInfo = useProblemInfo(url, chosenReduceTo);
const reducerInfo = useReducerInfo(url, chosenReductionType);
Expand Down Expand Up @@ -176,6 +179,23 @@ export default function ReduceToRowReact({
: TOOLTIP2
}
></PopoverTooltipClick>
{dragHandleProps && (
<IconButton
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
size="small"
title="Drag to reorder"
sx={{
cursor: 'grab',
color: '#424242',
backgroundColor: '#f5f5f5',
'&:hover': { backgroundColor: '#e0e0e0' },
mr: 1,
}}
>
<DragIndicatorIcon />
</IconButton>
)}
</ProblemSection.Header>

<ProblemSection.Body>
Expand Down
20 changes: 20 additions & 0 deletions components/pageblocks/SolveRowReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useContext } from "react";
import "bootstrap/dist/css/bootstrap.min.css";
import { Button } from "@mui/material";
import { Download as DownloadIcon } from '@mui/icons-material';
import { DragIndicator as DragIndicatorIcon } from '@mui/icons-material';
import { IconButton } from '@mui/material';

import { requestSolvedInstance } from "../redux";
import PopoverTooltipClick from "../widgets/PopoverTooltipClick";
Expand Down Expand Up @@ -45,6 +47,7 @@ export default function SolveRowReact({
solverNameMap,
problemNameMap,
chosenReduceTo,
dragHandleProps,
}) {
const solverInfo = useSolverInfo(url, chosenSolver);

Expand Down Expand Up @@ -114,6 +117,23 @@ export default function SolveRowReact({
}}
/>{" "}
<PopoverTooltipClick toolTip={tip} />
{dragHandleProps && (
<IconButton
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
size="small"
title="Drag to reorder"
sx={{
cursor: 'grab',
color: '#424242',
backgroundColor: '#f5f5f5',
'&:hover': { backgroundColor: '#e0e0e0' },
mr: 1,
}}
>
<DragIndicatorIcon />
</IconButton>
)}
</ProblemSection.Header>

<ProblemSection.Body>
Expand Down
20 changes: 20 additions & 0 deletions components/pageblocks/VerifyRowReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useContext, useEffect, useState } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css'
import { FormControl } from 'react-bootstrap'
import { Button } from '@mui/material'
import { DragIndicator as DragIndicatorIcon } from '@mui/icons-material';
import { IconButton } from '@mui/material';

import { requestVerifiedInstance, requestIsCertificateValid } from '../redux';
import PopoverTooltipClick from '../widgets/PopoverTooltipClick';
Expand All @@ -34,6 +36,7 @@ export default function VerifyRowReact({
setChosenVerifier,
verifierOptions,
verifierNameMap,
dragHandleProps,
}) {
const [certificate, setCertificate] = useState("");
const [verifyResult, setVerifyResult] = useState("");
Expand Down Expand Up @@ -98,6 +101,23 @@ export default function VerifyRowReact({
: TOOLTIP
}
></PopoverTooltipClick>
{dragHandleProps && (
<IconButton
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
size="small"
title="Drag to reorder"
sx={{
cursor: 'grab',
color: '#424242',
backgroundColor: '#f5f5f5',
'&:hover': { backgroundColor: '#e0e0e0' },
mr: 1,
}}
>
<DragIndicatorIcon />
</IconButton>
)}
</ProblemSection.Header>

<ProblemSection.Body>
Expand Down
19 changes: 19 additions & 0 deletions components/pageblocks/VisualizeRowReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
FastForward,
} from "@mui/icons-material";
import RefreshIcon from "@mui/icons-material/Refresh";
import { DragIndicator as DragIndicatorIcon } from '@mui/icons-material';
import Link from "next/link"; // <-- IMPORTANT for Quantum button

import PopoverTooltipClick from "../widgets/PopoverTooltipClick";
Expand Down Expand Up @@ -71,6 +72,7 @@ export default function VisualizeRowReact({
VisualizationOptions,
defaultVisualizationMap,
visualizationTypeMap,
dragHandleProps,
}) {
const visualizationInfo = useVisualizationInfo(url, chosenVisualization);

Expand Down Expand Up @@ -371,6 +373,23 @@ export default function VisualizeRowReact({
/>

<PopoverTooltipClick toolTip={tip} />
{dragHandleProps && (
<IconButton
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
size="small"
title="Drag to reorder"
sx={{
cursor: 'grab',
color: '#424242',
backgroundColor: '#f5f5f5',
'&:hover': { backgroundColor: '#e0e0e0' },
mr: 1,
}}
>
<DragIndicatorIcon />
</IconButton>
)}
</ProblemSection.Header>

<ProblemSection.Body>
Expand Down
56 changes: 56 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"postinstall": "next telemetry disable"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@fontsource/roboto": "^5.3.0",
Expand Down
Loading
Loading