-
-
Notifications
You must be signed in to change notification settings - Fork 233
feat: add dedicated tire outings dashboard page #308
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
Open
Anton15K
wants to merge
3
commits into
slowlydev:main
Choose a base branch
from
Anton15K:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import OutingTable from "@/components/dashboard/OutingTable"; | ||
|
|
||
| export default function TiresPage() { | ||
| return ( | ||
| <div className="flex min-h-full w-full flex-col"> | ||
| <div className="flex flex-col gap-1 border-b border-zinc-800 p-4"> | ||
| <h1 className="text-2xl font-bold tracking-tight">Tire Outings</h1> | ||
| <p className="text-sm text-zinc-500">Real-time history of tire compounds and outing progression.</p> | ||
| </div> | ||
|
|
||
| <div className="flex-1"> | ||
| <OutingTable /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| "use client"; | ||
|
|
||
| import { AnimatePresence, LayoutGroup, motion } from "motion/react"; | ||
| import clsx from "clsx"; | ||
|
|
||
| import { useDataStore } from "@/stores/useDataStore"; | ||
| import { useSettingsStore } from "@/stores/useSettingsStore"; | ||
| import { sortPos } from "@/lib/sorting"; | ||
|
|
||
| import DriverTag from "@/components/driver/DriverTag"; | ||
| import DriverHistoryTires from "@/components/driver/DriverHistoryTires"; | ||
|
|
||
| export default function OutingTable() { | ||
| const drivers = useDataStore(({ state }) => state?.DriverList); | ||
| const driversTiming = useDataStore(({ state }) => state?.TimingData); | ||
| const appDriversTiming = useDataStore(({ state }) => state?.TimingAppData); | ||
|
|
||
| const oledMode = useSettingsStore((state) => state.oledMode); | ||
|
|
||
| return ( | ||
| <div className="flex w-full flex-col"> | ||
| <div | ||
| className="grid items-center gap-4 border-b border-zinc-800 bg-zinc-900/10 px-4 py-2 text-xs font-bold uppercase tracking-widest text-zinc-500" | ||
| style={{ gridTemplateColumns: "7rem 1fr" }} | ||
| > | ||
| <p>Driver</p> | ||
| <p>Tire History / Outings</p> | ||
| </div> | ||
|
|
||
| {(!drivers || !driversTiming) && | ||
| new Array(20).fill("").map((_, index) => <SkeletonRow key={`outing.loading.${index}`} />)} | ||
|
|
||
| <LayoutGroup id="outings"> | ||
| <div className="flex flex-col divide-y divide-zinc-800/50"> | ||
| {drivers && driversTiming && ( | ||
| <AnimatePresence mode="popLayout"> | ||
| {Object.values(driversTiming.Lines) | ||
| .sort(sortPos) | ||
| .map((timingDriver, index) => { | ||
| const driver = drivers[timingDriver.RacingNumber]; | ||
| const appTiming = appDriversTiming?.Lines[timingDriver.RacingNumber]; | ||
|
|
||
| return ( | ||
| <motion.div | ||
| key={`outing.row.${timingDriver.RacingNumber}`} | ||
| layout | ||
| initial={{ opacity: 0 }} | ||
| animate={{ opacity: 1 }} | ||
| exit={{ opacity: 0 }} | ||
| className={clsx("grid items-center gap-4 px-4 py-3 transition-colors hover:bg-zinc-900/40", { | ||
| "bg-black": oledMode, | ||
| "bg-zinc-950/20": !oledMode, | ||
| })} | ||
| style={{ gridTemplateColumns: "7rem 1fr" }} | ||
| > | ||
| <DriverTag | ||
| className="min-w-full!" | ||
| short={driver.Tla} | ||
| teamColor={driver.TeamColour} | ||
| position={index + 1} | ||
| /> | ||
| <div className="no-scrollbar overflow-x-auto"> | ||
| <DriverHistoryTires stints={appTiming?.Stints} /> | ||
| </div> | ||
| </motion.div> | ||
| ); | ||
| })} | ||
| </AnimatePresence> | ||
| )} | ||
| </div> | ||
| </LayoutGroup> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function SkeletonRow() { | ||
| return ( | ||
| <div className="grid items-center gap-4 border-b border-zinc-800/30 px-4 py-3" style={{ gridTemplateColumns: "7rem 1fr" }}> | ||
| <div className="h-10 animate-pulse rounded-lg bg-zinc-800" /> | ||
| <div className="flex gap-3"> | ||
| {[1, 2, 3].map((i) => ( | ||
| <div key={i} className="flex flex-col items-center gap-2"> | ||
| <div className="h-8 w-8 animate-pulse rounded-full bg-zinc-800" /> | ||
| <div className="h-3 w-6 animate-pulse rounded bg-zinc-800" /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stint.Newis typed as a string and the help example models a used set by omittingNew(only settingNew: "TRUE"for new tires). With the current checkstint.New === "FALSE", stints whereNewis undefined (likely used sets) won’t get the used-set marker. Consider aligning this logic with the existingDriverTirebehavior and treating anything other than an explicit "TRUE" as used (or otherwise normalize/clarify the data contract).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the data form the api (like here: https://rt-api.f1-dash.com/api/current)
stint.New has "true" or "false" as values. and not uppercase.