Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Landing touchups #654

Merged
merged 6 commits into from
Feb 13, 2025
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
2 changes: 1 addition & 1 deletion e2e/tests/regression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test("can play around", async ({ page }) => {
// pixels, creating a significant diff... not sure how to fix this (probably need to file an issue?),
// but masking the images is a workaround for now.
page.getByRole("img", { name: "problem solving diagram" }),
page.getByRole("img", { name: "criteria tables of cars-going" }),
page.getByRole("img", { name: "clicking between views in cars-going-too-fast topic" }),
],
});

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/pages/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ const Home: NextPage = () => {
</div>
</section>

<section className="flex justify-center odd:bg-paperPlain-main even:bg-paperShaded-main">
<div className="w-full max-w-6xl px-4 py-8 sm:p-8">
<UseCasesSection />
</div>
</section>

<section
id="features"
className="flex justify-center odd:bg-paperPlain-main even:bg-paperShaded-main"
Expand All @@ -52,6 +46,12 @@ const Home: NextPage = () => {
</div>
</section>

<section className="flex justify-center odd:bg-paperPlain-main even:bg-paperShaded-main">
<div className="w-full max-w-6xl px-4 py-8 sm:p-8">
<UseCasesSection />
</div>
</section>

<section className="flex justify-center odd:bg-paperPlain-main even:bg-paperShaded-main">
<div className="w-full max-w-6xl px-4 py-8 sm:p-8">
<ImprovingSection />
Expand Down
2 changes: 1 addition & 1 deletion src/web/comment/store/commentStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { apiSyncer } from "@/web/comment/store/apiSyncerMiddleware";
import { emitter } from "@/web/common/event";
import { storageWithDates } from "@/web/common/store/utils";
import { StoreTopic } from "@/web/topic/store/store";
import { setSelected } from "@/web/view/currentViewStore/store";
import { toggleShowResolvedComments } from "@/web/view/miscTopicConfigStore";
import { setSelected } from "@/web/view/selectedPartStore";

export type StoreComment = Omit<Comment, "topicId">;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContextMenuItem } from "@/web/common/components/ContextMenu/CloseOnClickMenuItem";
import { emitter } from "@/web/common/event";
import { GraphPart } from "@/web/topic/utils/graph";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

export const ViewDetailsMenuItem = ({ graphPart }: { graphPart: GraphPart }) => {
return (
Expand Down
124 changes: 62 additions & 62 deletions src/web/home/FeaturesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,45 @@ import { Link, Tab, Typography } from "@mui/material";
import Image from "next/image";
import { useState } from "react";

type Tab = "tradeoffs" | "views" | "flashlight" | "disagree";
type Tab = "views" | "disagree" | "tradeoffs" | "flashlight";

const copy = {
tradeoffs: {
title: "Summarize tradeoffs between solutions",
description:
"Show how important you think each tradeoff is, and how well each solution fulfills that tradeoff.",
views: {
title: "Focus on different aspects",
description: "Create views to highlight specific parts of the diagram.",
content: (
<div>
<Image
src="https://github.com/user-attachments/assets/60ac157d-03f7-4fa5-907b-b8e3abab0e7a"
alt="criteria tables of cars-going-too-fast"
width={727}
height={455}
unoptimized
src="https://github.com/user-attachments/assets/87055acd-debb-45f2-981f-ef511e770222"
alt="clicking between views in cars-going-too-fast topic"
width={1096}
height={847}
unoptimized // warning without this - gifs aren't optimized by nextjs apparently
// extra padding & bg because spacing seems to look better
className="rounded-xl border bg-paperPlain-main p-3 shadow"
className="rounded-xl border bg-paperPlain-main p-2 shadow"
/>
<Typography variant="caption">
Topic:{" "}
<Link
href="https://ameliorate.app/examples/detailed-cars-going-too-fast?view=Tradeoff+table"
target="_blank"
>
<Link href="https://ameliorate.app/examples/detailed-cars-going-too-fast" target="_blank">
cars-going-too-fast
</Link>
</Typography>
</div>
),
},
views: {
title: "Focus on different aspects",
description: "Create views to highlight specific parts of the diagram.",
disagree: {
title: "Quickly identify where you disagree",
description:
"Compare scores to efficiently understand where your opinions lie in relation to others.",
content: (
<div>
<Image
src="https://github.com/user-attachments/assets/87055acd-debb-45f2-981f-ef511e770222"
alt="clicking between views in cars-going-too-fast topic"
width={1096}
height={847}
src="https://github.com/user-attachments/assets/c1c9043a-4a0f-4af6-a309-ab3574301054"
alt="comparing scores in cars-going-too-fast topic"
width={756}
height={703}
unoptimized // warning without this - gifs aren't optimized by nextjs apparently
// extra padding & bg because spacing seems to look better
className="rounded-xl border bg-paperPlain-main p-2 shadow"
className="rounded-xl border shadow"
/>
<Typography variant="caption">
Topic:{" "}
Expand All @@ -56,46 +52,50 @@ const copy = {
</div>
),
},
flashlight: {
title: "Move through complex diagrams",
description: "Use flashlight mode to easily explore large diagrams.",
tradeoffs: {
title: "Summarize tradeoffs between solutions",
description:
"Show how important you think each tradeoff is, and how well each solution fulfills that tradeoff.",
content: (
<div>
<Image
src="https://github.com/user-attachments/assets/98d75b2b-6ca4-41cd-9322-314c75126232"
alt="using flashlight mode in brutality-sugar topic"
width={1022}
height={728}
unoptimized // warning without this - gifs aren't optimized by nextjs apparently
className="rounded-xl border shadow"
src="https://github.com/user-attachments/assets/60ac157d-03f7-4fa5-907b-b8e3abab0e7a"
alt="criteria tables of cars-going-too-fast"
width={727}
height={455}
unoptimized
// extra padding & bg because spacing seems to look better
className="rounded-xl border bg-paperPlain-main p-3 shadow"
/>
<Typography variant="caption">
Topic:{" "}
<Link href="https://ameliorate.app/keyserj/brutality-sugar-article" target="_blank">
brutality-sugar-article
<Link
href="https://ameliorate.app/examples/detailed-cars-going-too-fast?view=Tradeoff+table"
target="_blank"
>
cars-going-too-fast
</Link>
</Typography>
</div>
),
},
disagree: {
title: "Quickly identify where you disagree",
description:
"Compare scores to efficiently understand where your opinions lie in relation to others.",
flashlight: {
title: "Move through complex diagrams",
description: "Use flashlight mode to easily explore large diagrams.",
content: (
<div>
<Image
src="https://github.com/user-attachments/assets/c1c9043a-4a0f-4af6-a309-ab3574301054"
alt="comparing scores in cars-going-too-fast topic"
width={756}
height={703}
src="https://github.com/user-attachments/assets/98d75b2b-6ca4-41cd-9322-314c75126232"
alt="using flashlight mode in brutality-sugar topic"
width={1022}
height={728}
unoptimized // warning without this - gifs aren't optimized by nextjs apparently
className="rounded-xl border shadow"
/>
<Typography variant="caption">
Topic:{" "}
<Link href="https://ameliorate.app/examples/detailed-cars-going-too-fast" target="_blank">
cars-going-too-fast
<Link href="https://ameliorate.app/keyserj/brutality-sugar-article" target="_blank">
brutality-sugar-article
</Link>
</Typography>
</div>
Expand All @@ -104,20 +104,34 @@ const copy = {
};

export const FeaturesSection = () => {
const [selectedCard, setSelectedCard] = useState<Tab>("tradeoffs");
const [selectedCard, setSelectedCard] = useState<Tab>("views");

return (
<div className="flex flex-col text-center">
<Typography variant="h4">Some cool features</Typography>

<TabContext value={selectedCard}>
<TabList onChange={(_, value: Tab) => setSelectedCard(value)} variant="fullWidth">
<Tab label={copy.tradeoffs.title} value="tradeoffs" wrapped />
<Tab label={copy.views.title} value="views" wrapped />
<Tab label={copy.flashlight.title} value="flashlight" wrapped />
<Tab label={copy.disagree.title} value="disagree" wrapped />
<Tab label={copy.tradeoffs.title} value="tradeoffs" wrapped />
<Tab label={copy.flashlight.title} value="flashlight" wrapped />
</TabList>

<TabPanel key="views" value="views" className="flex flex-col items-center gap-2 p-0">
<Typography variant="body1" className="pt-3">
{copy.views.description}
</Typography>
{copy.views.content}
</TabPanel>

<TabPanel key="disagree" value="disagree" className="flex flex-col items-center gap-2 p-0">
<Typography variant="body1" className="pt-3">
{copy.disagree.description}
</Typography>
{copy.disagree.content}
</TabPanel>

<TabPanel
key="tradeoffs"
value="tradeoffs"
Expand All @@ -129,13 +143,6 @@ export const FeaturesSection = () => {
{copy.tradeoffs.content}
</TabPanel>

<TabPanel key="views" value="views" className="flex flex-col items-center gap-2 p-0">
<Typography variant="body1" className="pt-3">
{copy.views.description}
</Typography>
{copy.views.content}
</TabPanel>

<TabPanel
key="flashlight"
value="flashlight"
Expand All @@ -146,13 +153,6 @@ export const FeaturesSection = () => {
</Typography>
{copy.flashlight.content}
</TabPanel>

<TabPanel key="disagree" value="disagree" className="flex flex-col items-center gap-2 p-0">
<Typography variant="body1" className="pt-3">
{copy.disagree.description}
</Typography>
{copy.disagree.content}
</TabPanel>
</TabContext>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/CriteriaTable/EdgeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CommonIndicators } from "@/web/topic/components/Indicator/CommonIndicat
import { ContentIndicators } from "@/web/topic/components/Indicator/ContentIndicators";
import { StatusIndicators } from "@/web/topic/components/Indicator/StatusIndicators";
import { Edge } from "@/web/topic/utils/graph";
import { setSelected, useIsGraphPartSelected } from "@/web/view/currentViewStore/store";
import { setSelected, useIsGraphPartSelected } from "@/web/view/selectedPartStore";

export const EdgeCell = ({ edge }: { edge: Edge }) => {
const selected = useIsGraphPartSelected(edge.id);
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Diagram/Diagram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { hotkeys } from "@/web/topic/utils/hotkeys";
import { FlowNodeType } from "@/web/topic/utils/node";
import { tutorialIsOpen } from "@/web/tutorial/tutorial";
import { useFlashlightMode } from "@/web/view/actionConfigStore";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

const buildNodeComponent = (type: FlowNodeType) => {
// eslint-disable-next-line react/display-name -- react flow dynamically creates these components without name anyway
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Edge/ScoreEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useUserCanEditTopicData } from "@/web/topic/store/userHooks";
import { Edge } from "@/web/topic/utils/graph";
import { useUnrestrictedEditing } from "@/web/view/actionConfigStore";
import { useAvoidEdgeLabelOverlap } from "@/web/view/currentViewStore/layout";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

const flowMarkerId = "flowMarker";
const nonFlowMarkerId = "nonFlowMarker";
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Edge/StandaloneEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EditableNode } from "@/web/topic/components/Node/EditableNode";
import { nodeWidthPx } from "@/web/topic/components/Node/EditableNode.styles";
import { useNode } from "@/web/topic/store/nodeHooks";
import { Edge } from "@/web/topic/utils/graph";
import { useIsGraphPartSelected } from "@/web/view/currentViewStore/store";
import { useIsGraphPartSelected } from "@/web/view/selectedPartStore";

const convertToStandaloneFlowEdge = (edge: Edge, selected: boolean): EdgeProps => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Indicator/CommentIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useCommentCount } from "@/web/comment/store/commentStore";
import { emitter } from "@/web/common/event";
import { Indicator } from "@/web/topic/components/Indicator/Indicator";
import { GraphPartType } from "@/web/topic/utils/graph";
import { setSelected } from "@/web/view/currentViewStore/store";
import { useShowResolvedComments } from "@/web/view/miscTopicConfigStore";
import { setSelected } from "@/web/view/selectedPartStore";

interface Props {
graphPartId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useResearchNodes } from "@/web/topic/store/graphPartHooks";
import { useDisplayScores } from "@/web/topic/store/scoreHooks";
import { Score } from "@/web/topic/utils/graph";
import { getNumericScore, scoreColors } from "@/web/topic/utils/score";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

interface Props {
graphPartId: string;
Expand Down
9 changes: 6 additions & 3 deletions src/web/topic/components/Indicator/Indicator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { type ButtonProps } from "@mui/material";
import { MouseEventHandler } from "react";
import { MouseEventHandler, useContext } from "react";

import { StyledButton } from "@/web/topic/components/Indicator/Indicator.styles";
import { WorkspaceContext } from "@/web/topic/components/TopicWorkspace/WorkspaceContext";
import { MuiIcon } from "@/web/topic/utils/node";
import { useShowIndicators } from "@/web/view/userConfigStore";

Expand All @@ -25,6 +26,7 @@ export const Indicator = ({
filled = true,
graphPartIndicator = true,
}: IndicatorProps) => {
const workspaceContext = useContext(WorkspaceContext);
const showIndicators = useShowIndicators();

const onClickHandler = (event: React.MouseEvent<HTMLButtonElement>) => {
Expand All @@ -36,8 +38,9 @@ export const Indicator = ({
}
};

// no need to hide indicators that aren't for graph parts e.g. JustificationTreeIndicator
const showIndicator = showIndicators || !graphPartIndicator;
// Nice to always show indicators in details view so there's some way for new users to be exposed to them.
// No need to hide indicators that aren't for graph parts e.g. JustificationTreeIndicator.
const showIndicator = workspaceContext === "details" || showIndicators || !graphPartIndicator;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTopLevelJustification } from "@/web/topic/store/graphPartHooks";
import { useDisplayScores } from "@/web/topic/store/scoreHooks";
import { Score } from "@/web/topic/utils/graph";
import { getNumericScore, scoreColors } from "@/web/topic/utils/score";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

interface Props {
graphPartId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Indicator/NotesIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCallback } from "react";

import { emitter } from "@/web/common/event";
import { Indicator } from "@/web/topic/components/Indicator/Indicator";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

interface Props {
graphPartId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Indicator/QuestionIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useResearchNodes } from "@/web/topic/store/graphPartHooks";
import { useDisplayScores } from "@/web/topic/store/scoreHooks";
import { Score } from "@/web/topic/utils/graph";
import { getNumericScore, scoreColors } from "@/web/topic/utils/score";
import { setSelected } from "@/web/view/currentViewStore/store";
import { setSelected } from "@/web/view/selectedPartStore";

interface Props {
graphPartId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/web/topic/components/Node/EditableNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useUserCanEditTopicData } from "@/web/topic/store/userHooks";
import { Node } from "@/web/topic/utils/graph";
import { nodeDecorations } from "@/web/topic/utils/node";
import { useUnrestrictedEditing } from "@/web/view/actionConfigStore";
import { setSelected, useIsGraphPartSelected } from "@/web/view/currentViewStore/store";
import { setSelected, useIsGraphPartSelected } from "@/web/view/selectedPartStore";
import { useFillNodesWithColor } from "@/web/view/userConfigStore";

interface Props {
Expand Down
6 changes: 4 additions & 2 deletions src/web/topic/components/Score/Score.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export const Score = ({ graphPartId }: ScoreProps) => {
) : undefined;
const isInteractive = hoverCircle !== undefined;

// always show score on table because the main purpose of the table is to compare scores
const showScore = showIndicators || workspaceContext === "table";
// Nice to show scores in details view so there's some way for new users to be exposed to them.
// Always show score on table because the main purpose of the table is to compare scores.
const showScore =
workspaceContext === "table" || workspaceContext === "details" || showIndicators;
const showScoreClasses = showScore ? "" : " hidden";

if (!isInteractive) {
Expand Down
Loading
Loading