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

Design system/question layout #73

Open
wants to merge 103 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
49962aa
wip: questionPage and its layout components folder structure cleanup,…
mewdev Dec 4, 2024
2ddf85c
wip: clientWrapper workaround component, data test
mewdev Dec 5, 2024
c705746
wip: data binded to the questionCard component
mewdev Dec 5, 2024
5525981
wip: adding simple interactivity
mewdev Dec 6, 2024
40812fa
wip: added simple interactivity for steps, needs fix with questionCount
mewdev Dec 9, 2024
e780729
wip: steps with currentQuestion count fixed
mewdev Dec 9, 2024
5ed3045
wip: styling status bar working, active status bar needs fix
mewdev Dec 10, 2024
29b03da
wip: guide and results subpages with mockup content introduec
mewdev Dec 10, 2024
617efab
wip: some errors fixed, debugging active step glitch
mewdev Dec 10, 2024
139cf22
wip: statusbar interactivity fixed with all buttons, rekapitulace co…
mewdev Dec 11, 2024
41b064e
wip: important added to answers and state change works, fix needed: u…
mewdev Dec 11, 2024
5b9a9b2
wip: toggleStarIcon state pressed and preserved, fix needed: rerender…
mewdev Dec 12, 2024
b9f973c
wip: fixed rerender of starToggleIcon, needs refactoring then
mewdev Dec 12, 2024
01869f8
fix: vscode syntax errors fixed
mewdev Dec 13, 2024
93aad31
wip: testing next dynamic router with questions data
mewdev Dec 16, 2024
f4b4d3a
wip: dynamic route updated to have a index number of the question
mewdev Dec 16, 2024
9b24f1a
wip: implementing layouts to the new improved routing
mewdev Dec 18, 2024
46a869b
wip: questions pages architecture test
mewdev Dec 18, 2024
79dba0c
wip: questions pages architecture test continuation
mewdev Dec 19, 2024
2c82878
wip: rework with zustand, testing zustand
mewdev Dec 21, 2024
487ed25
wip: skip/previous and toggle working
mewdev Dec 21, 2024
b85c307
wip: answer yes/no working
mewdev Dec 21, 2024
1aca9fb
wip: components integration (bottomBar)
mewdev Dec 23, 2024
137c2d3
wip: component integration and refactor (questionWrapper)
mewdev Dec 23, 2024
4407d4f
wip: initializer, fetching data and updating the store
mewdev Dec 23, 2024
b52c9c1
wip: bottom bar toggle button state bug fixed
mewdev Dec 25, 2024
2895c55
wip: type errors fixed
mewdev Dec 25, 2024
cbfb930
wip: dynamic url test
mewdev Dec 25, 2024
d7f0a47
wip: mockup url update works
mewdev Dec 28, 2024
ffc8546
wip: guide interactivity sketch
mewdev Dec 28, 2024
2a33d8d
wip: rekapitulace page sketch
mewdev Dec 29, 2024
4965550
wip: recapitulation components
mewdev Dec 30, 2024
5623155
wip: toggleStarComponent children optimization, recapitulationCard co…
mewdev Dec 30, 2024
5e6b20f
wip: recapitulation card component interactivity
mewdev Dec 30, 2024
addfa8c
wip: recapitulation card interactivity working
mewdev Dec 31, 2024
e7b46be
wip: recapitulation cad small fixes
mewdev Dec 31, 2024
3734b99
wip: toggleImportant (recapitulation)
mewdev Jan 1, 2025
f21b125
wip: toggleImportant (recapitulation card) working, updated toggleSta…
mewdev Jan 1, 2025
5a8ac1a
wip: toggleImportant starPressed fix
mewdev Jan 2, 2025
bba3281
wip: fixing flow redirections and components visibility
mewdev Jan 3, 2025
54d1ded
wip: fixing flow redirections and components visibility
mewdev Jan 3, 2025
5a180e2
refactor: rename testQuestions to questions for clarity and consisten…
mewdev Jan 6, 2025
d82d4b1
wip: questionsPage (/xyz) refactor within /abc route, context test, b…
mewdev Jan 9, 2025
c37dc88
wip: implement question navigation and URL updates using Zustand stor…
mewdev Jan 9, 2025
0f3bcea
wip: migrated from mockup counter store to questions store, update co…
mewdev Jan 9, 2025
7829734
wip: implement dynamic question fetching and update URL handling
mewdev Jan 9, 2025
4162d12
wip: remove unused components and restructure question handling in th…
mewdev Jan 9, 2025
5b8d657
wip: updated question and guide handling in store, enhance data struc…
mewdev Jan 10, 2025
e9130cd
wip: enhance question handling with extended types, update layout
mewdev Jan 10, 2025
36662dd
wip: enhance question handling with new answer types and toggle funct…
mewdev Jan 10, 2025
c3d3800
wip: guide css refactor
mewdev Jan 11, 2025
7f50eb9
refactor: update layout and styling for guide page
mewdev Jan 11, 2025
d71b627
wip: guidePage styling improvements, updated navigation arrows for gu…
mewdev Jan 12, 2025
6e89b26
wip: implemened guide card components and its data
mewdev Jan 12, 2025
6d406e4
wip: rekapitulace page
mewdev Jan 12, 2025
6f80eb9
wip: rekapitulace page, added PercentageIcon component to design syst…
mewdev Jan 13, 2025
4eaa2a6
wip: implemented and polished RecapitulationCard component and integr…
mewdev Jan 13, 2025
0dc8078
wip: refactor toggleImportant functionality in storeProvider, refacto…
mewdev Jan 13, 2025
80a4264
wip: refactoring store (answerYes, answerNo, toggleImportant)
mewdev Jan 13, 2025
b92b632
wip: refactoring store (isRekapitulace), added new route structure t…
mewdev Jan 14, 2025
1752974
wip: refactored storeProvider (rekapitulace no nextQuestion setter), …
mewdev Jan 15, 2025
711874a
wip: testing urlUpdater
mewdev Jan 15, 2025
42a718d
wip: url dynamic changing, updated button urls
mewdev Jan 15, 2025
c752f31
refactor: allow currentQuestion and guideNumber to be null (storeProv…
mewdev Jan 15, 2025
5904d2c
wip: refactoring css
mewdev Jan 16, 2025
7b2b4c5
wip:testing toggleAnswerButtons (
mewdev Jan 16, 2025
dcf4e18
wip: added toggle buttons for yes, no, and neutral responses, working…
mewdev Jan 16, 2025
a41e708
wip: fixed logic for yes and no button pressed states
mewdev Jan 16, 2025
e16439a
wip: enhanced toggle button functionality and interaction logic
mewdev Jan 19, 2025
2ecfdbd
wip: update toggle button logic and props handling for better state m…
mewdev Jan 19, 2025
93a58f6
wip: optimize URL and title update logic in UrlUpdater component
mewdev Jan 19, 2025
1f233a7
wip: improve edge case handling in question and guide navigation logi…
mewdev Jan 20, 2025
a73c498
wip: clientblobs workaround implemented in rootlayout
mewdev Jan 20, 2025
ad03d2a
refactor: simplify URL and state management logic in UrlUpdater compo…
mewdev Jan 20, 2025
e6fee70
wip: refactored rekapitulace sticky header + toggleStarIcon, fixed bo…
mewdev Jan 20, 2025
5a7e589
wip: refactoring layout
mewdev Jan 21, 2025
9f770ee
wip: refactoring layout (guide)
mewdev Jan 22, 2025
1e53429
wip: refactoring layout (questions page)
mewdev Jan 22, 2025
cdea7e4
wip: refactoring layout (rekapitulace)
mewdev Jan 22, 2025
d8f61fe
wip: refactoring layout (rekapitulace)
mewdev Jan 22, 2025
0c5ccad
wip: refactoring layout (rekapitulace)
mewdev Jan 22, 2025
b284fc8
wip: refactoring layout (question)
mewdev Jan 23, 2025
49b9e57
wip: refactoring layout (question)
mewdev Jan 23, 2025
d09a65d
wip: refactoring button toggle width states (question)
mewdev Jan 23, 2025
08475c6
wip: refactoring layouts (toggleButtons, question)
mewdev Jan 24, 2025
2210cc1
wip: refactoring layout (starToggleButton)
mewdev Jan 24, 2025
832a114
wip: refactoring layout (recapitulation)
mewdev Jan 24, 2025
b3e5f55
wip: refactor layout and button styles for recapitulation page
mewdev Jan 24, 2025
6402304
wip: refactoring layout (recapitulationCard)
mewdev Jan 24, 2025
aaad4c2
wip: refactor recapitulation layout and button states, continuing fix…
mewdev Jan 25, 2025
9645530
wip: minors code cleanup
mewdev Jan 25, 2025
7140459
wip: refactored guide number and question number handling in useEffect
mewdev Jan 25, 2025
f1f55b4
wip: recapCard fixes (ongoing)
mewdev Jan 26, 2025
f058088
wip: fixed layout and toggle content visibility in RecapitulationCard
mewdev Jan 26, 2025
d74d0f8
wip implemented results page layout with ResultCard component and moc…
mewdev Jan 26, 2025
c5e3518
wip: added 'vysledky' location handling and updated related component…
mewdev Jan 26, 2025
30c59a8
fix: update layout classes and set default currentQuestion in storePr…
mewdev Jan 26, 2025
fb59c6a
refactor: improve button navigation and URL handling in various compo…
mewdev Jan 26, 2025
ef971c2
wip: redirection implemented after last question answered
mewdev Jan 27, 2025
1ed0b78
wip: fixed guideNumber useEffect setter
mewdev Jan 27, 2025
4aa9c00
wip: fixed urlUpdater url glitches
mewdev Jan 31, 2025
56be335
refactor: added cleanups in UrlUpdater component and simplified clean…
mewdev Jan 31, 2025
160ee01
fix: fixing lint and build errors
mewdev Feb 9, 2025
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
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@
],
"typescript.preferences.importModuleSpecifier": "non-relative",
"eslint.format.enable": true,
"eslint.workingDirectories": [{ "pattern": "./packages/*/" }, { "pattern": "./apps/*/" }],
"eslint.workingDirectories": [
{
"pattern": "./packages/*/"
},
{
"pattern": "./apps/*/"
}
],
}
14 changes: 14 additions & 0 deletions apps/design-system/stories/bottomBar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Meta, StoryObj } from "@storybook/react";

import { BottomBar } from "@repo/design-system/ui";

const meta: Meta<typeof BottomBar> = {
title: "Layout/BottomBar",
component: BottomBar,
};

type BottomBarStory = StoryObj<typeof meta>;

export const Default: BottomBarStory = {};

export default meta;
4 changes: 2 additions & 2 deletions apps/design-system/stories/iconButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IconButton } from "@repo/design-system/iconButton";
import { StarIcon } from "@repo/design-system/starIcon";
import { IconButton } from "@repo/design-system/ui";
import { StarIcon } from "@repo/design-system/icons";
import { Meta, StoryObj } from "@storybook/react";

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Question } from "@repo/design-system/ui";
import { QuestionCard } from "@repo/design-system/ui";

const meta: Meta<typeof Question> = {
title: "Layouts/Question",
component: Question,
const meta: Meta<typeof QuestionCard> = {
title: "Layout/Question",
component: QuestionCard,
};

type QuestionStory = StoryObj<typeof meta>;
Expand Down
2 changes: 1 addition & 1 deletion apps/design-system/stories/starIconButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StarIconButton } from "@repo/design-system/starIconButton";
import { StarIconButton } from "../../../packages/design-system/src/ui/iconButton/starIconButton";
import { Meta, StoryObj } from "@storybook/react";

export default {
Expand Down
2 changes: 1 addition & 1 deletion apps/design-system/stories/toggleButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { YesIcon } from "@repo/design-system/demo";
import { ToggleButton } from "@repo/design-system/toggleButton";
import { ToggleButton } from "@repo/design-system/ui";
import { Meta, StoryObj } from "@storybook/react";

export default {
Expand Down
2 changes: 1 addition & 1 deletion apps/design-system/stories/toggleIconButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta, StoryObj } from "@storybook/react";
import { ToggleIconButton } from "@repo/design-system/toggleIconButton";
import { ToggleIconButton } from "@repo/design-system/ui";

export default {
title: "Components/ToggleIconButton",
Expand Down
62 changes: 0 additions & 62 deletions apps/web/app/[lang]/bottom-bar/page.tsx

This file was deleted.

73 changes: 0 additions & 73 deletions apps/web/app/[lang]/testpage/page.tsx

This file was deleted.

17 changes: 17 additions & 0 deletions apps/web/app/abc/answerNeutralToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ToggleButton } from "@repo/design-system/ui";
import { NeutralIcon } from "@repo/design-system/icons";
export default function AnswerYesToggle() {
return (
<ToggleButton
kind="inverse"
color="neutral"
icon={NeutralIcon}
iconPosition="left"
compactable
fitContent
wider
>
Nevím
</ToggleButton>
);
}
17 changes: 17 additions & 0 deletions apps/web/app/abc/answerNoToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ToggleButton } from "@repo/design-system/ui";
import { NoIcon } from "@repo/design-system/icons";
export default function AnswerYesToggle() {
return (
<ToggleButton
kind="inverse"
color="secondary"
icon={NoIcon}
iconPosition="left"
compactable
fitContent
wider
>
Ne
</ToggleButton>
);
}
17 changes: 17 additions & 0 deletions apps/web/app/abc/answerYesToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ToggleButton } from "@repo/design-system/ui";
import { YesIcon } from "@repo/design-system/icons";
export default function AnswerYesToggle() {
return (
<ToggleButton
kind="inverse"
color="primary"
icon={YesIcon}
iconPosition="left"
compactable
fitContent
wider
>
Ano
</ToggleButton>
);
}
6 changes: 6 additions & 0 deletions apps/web/app/abc/clientBlobs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use client";
import { Blobs } from "@repo/design-system/ui";

export default function ClientBlobs() {
return <Blobs />;
}
58 changes: 58 additions & 0 deletions apps/web/app/abc/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use client";

import { Logo } from "@repo/design-system/svg";
import { useQuestionsStore } from "./providers/storeProvider";
import { Button } from "@repo/design-system/ui";
import { CloseIcon } from "@repo/design-system/icons";
import { usePathname } from "next/navigation";

export default function Header() {
const guide = useQuestionsStore((state) => state.guide);
const path = usePathname();

return (
<header className="sticky bottom-0 max-w-[100vw] bg-white">
<div className="flex w-full items-center gap-2 p-2 xs:p-4 min-[576px]:gap-4 sm:p-8">
{/* logo wrapper */}
<div className="flex gap-2">
<Logo className="h-5 w-[5.953rem]" />
<div className="hidden text-sm font-bold uppercase sm:block">
Volební kalkulačka
</div>
</div>
<div className="flex flex-1 items-center justify-between">
{/* title component, refactor */}
{/* centered title fix on mobile!!! */}
{guide[0]?.title && guide[0]?.region ? (
<div>
<p
className="font-primary
text-sm text-neutral max-[575px]:text-xs"
>
{guide[0]?.title} — {guide[0]?.region}
</p>
</div>
) : null}
{/* refactor visiblity condition later */}
{path != "/" && (
<Button
fitContent
kind="link"
size="auto"
icon={CloseIcon}
hasIcon
iconPosition="right"
// refactor
onClick={() => alert("Back to home")}
>
<span className="hidden sm:inline">Zpět na hlavní stránku</span>
</Button>
)}
</div>
</div>
</header>
);
}

// TODO:
// 1. Check incode comments and fix/refactor
39 changes: 39 additions & 0 deletions apps/web/app/abc/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import "../globals.css";
import "@repo/design-system/styles";
import "@repo/design-system/themes/theme-default";
import { StoreProvider } from "./providers/storeProvider";
import UrlUpdater from "./utils/urlUpdater";
import getQuestions from "./utils/getQuestions";
import Header from "./header";
import ClientBlobs from "./clientBlobs";

const baseUrl =
"https://www.volebnikalkulacka.cz/data/instance/volebnikalkulacka.cz/krajske-2024/10-jihomoravsky/questions.json";

const questions = await getQuestions(baseUrl);

export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<StoreProvider questions={questions}>
<UrlUpdater>
<body>
{/* blob container */}
<div className="relative grid size-full">
<ClientBlobs />
{/* root layout */}
<div className="flex min-h-screen flex-col">
<Header />
{children}
</div>
</div>
</body>
</UrlUpdater>
</StoreProvider>
</html>
);
}
Loading