Skip to content

Commit

Permalink
touchup: zoom out table on mobile
Browse files Browse the repository at this point in the history
was a bit too big to see anything
  • Loading branch information
keyserj committed Jul 23, 2024
1 parent 173ce62 commit 859c145
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/web/topic/components/CriteriaTable/CriteriaTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EdgeCell } from "@/web/topic/components/CriteriaTable/EdgeCell";
import { NodeCell } from "@/web/topic/components/CriteriaTable/NodeCell";
import { SolutionTotalCell } from "@/web/topic/components/CriteriaTable/SolutionTotalCell";
import { TotalsHeaderCell } from "@/web/topic/components/CriteriaTable/TotalsHeaderCell";
import { tableZoomClasses } from "@/web/topic/components/CriteriaTable/tableZoom";
import { AddNodeButton } from "@/web/topic/components/Node/AddNodeButton";
import {
useCriterionSolutionEdges,
Expand Down Expand Up @@ -284,6 +285,9 @@ export const CriteriaTable = () => {
muiTablePaperProps={{
className: "criteria-table-paper",
}}
muiTableProps={{
className: tableZoomClasses,
}}
initialState={{
// this won't work if the last row's header is just "totals" as a string
columnPinning: { left: ["rowHeaderLabel"] },
Expand Down
4 changes: 4 additions & 0 deletions src/web/topic/components/CriteriaTable/tableZoom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Table is too big for small screens, so zoom out a little. Browsers still enable pinch to zoom in if this is too small.
*/
export const tableZoomClasses = "[zoom:60%] sm:[zoom:normal]";
6 changes: 5 additions & 1 deletion src/web/topic/components/Score/Score.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useRef, useState } from "react";
import { useContext, useRef, useState } from "react";

import { htmlDefaultFontSize } from "@/pages/_document.page";
import { useSessionUser } from "@/web/common/hooks";
import { tableZoomClasses } from "@/web/topic/components/CriteriaTable/tableZoom";
import { BackdropPopper, CircleDiv, ScorePopper } from "@/web/topic/components/Score/Score.styles";
import { ScoreButton, buttonDiameterRem } from "@/web/topic/components/Score/ScoreButton";
import { ScoreCompare } from "@/web/topic/components/Score/ScoreCompare";
import { ScoreSelect } from "@/web/topic/components/Score/ScoreSelect";
import { WorkspaceContext } from "@/web/topic/components/TopicWorkspace/WorkspaceContext";
import { useFlowZoom } from "@/web/topic/hooks/flowHooks";
import { useUserScores } from "@/web/topic/store/scoreHooks";
import { playgroundUsername } from "@/web/topic/store/store";
Expand All @@ -27,6 +29,7 @@ export const Score = ({ graphPartId }: ScoreProps) => {
const { sessionUser } = useSessionUser();
const onPlayground = useOnPlayground();
const readonlyMode = useReadonlyMode();
const workspaceContext = useContext(WorkspaceContext);

const myUsername = onPlayground ? playgroundUsername : sessionUser?.username;
const perspectives = usePerspectives();
Expand Down Expand Up @@ -121,6 +124,7 @@ export const Score = ({ graphPartId }: ScoreProps) => {
},
},
]}
className={workspaceContext === "table" ? tableZoomClasses : ""}
>
<CircleDiv circleDiameter={circleDiameter * zoomRatio}>{hoverCircle}</CircleDiv>

Expand Down

0 comments on commit 859c145

Please sign in to comment.