Compare commits
3 commits
45c626bbd2
...
2cc7629690
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cc7629690 | |||
| 3f906e5694 | |||
| 668c9f4ea6 |
4 changed files with 91 additions and 8 deletions
16
CHANGELOG.md
16
CHANGELOG.md
|
|
@ -1,5 +1,21 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# v0.9.1
|
||||||
|
|
||||||
|
Journals stay within the campaign timeline, and a live in-universe clock now ticks under the sidebar logo.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- **In-universe clock.** A live clock now sits under the unit logo in the sidebar. It shows the in-world date and time, ticking every second, so you always know what it is out there.
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- **Journal dates.** The in-world date on a journal can no longer be set before the Awakening (March 19, 2156) or past today's in-game day, and the picker opens on the present date when you start writing.
|
||||||
|
- **Days since the Awakening.** A short line under the date field shows the in-world date plus how many days it has been since the campaign began.
|
||||||
|
- **Related missions.** The related-mission dropdown now lists only main operations, so it is easier to attach the right one.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# v0.9.0
|
# v0.9.0
|
||||||
|
|
||||||
Personal journals, automatic awards and a dashboard you can rearrange arrive together, and every dashboard widget now wears the "tactical dossier" look.
|
Personal journals, automatic awards and a dashboard you can rearrange arrive together, and every dashboard widget now wears the "tactical dossier" look.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "polaris-task-force",
|
"name": "polaris-task-force",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.",
|
"description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ import { Progress } from "@/components/ui/progress";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { updatePreferences } from "@/app/(frontend)/account/actions";
|
import { updatePreferences } from "@/app/(frontend)/account/actions";
|
||||||
import { updateSidebarOrder } from "@/app/(frontend)/actions";
|
import { updateSidebarOrder } from "@/app/(frontend)/actions";
|
||||||
|
import InUniverseClock from "@/components/frontend/blocks/InUniverseClock";
|
||||||
import { sidebarData } from "@/components/frontend/blocks/sidebarData";
|
import { sidebarData } from "@/components/frontend/blocks/sidebarData";
|
||||||
import type { RegistryGame } from "@/lib/minigames/registry";
|
import type { RegistryGame } from "@/lib/minigames/registry";
|
||||||
import {
|
import {
|
||||||
|
|
@ -283,6 +284,7 @@ export function AppSidebar({
|
||||||
<span className="truncate font-medium">Polaris Task Force</span>
|
<span className="truncate font-medium">Polaris Task Force</span>
|
||||||
<span className="truncate text-xs">Enterprise</span>
|
<span className="truncate text-xs">Enterprise</span>
|
||||||
</div>*/}
|
</div>*/}
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
<div>
|
<div>
|
||||||
<Image
|
<Image
|
||||||
src="/images/logo.webp"
|
src="/images/logo.webp"
|
||||||
|
|
@ -291,6 +293,8 @@ export function AppSidebar({
|
||||||
height={164}
|
height={164}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<InUniverseClock />
|
||||||
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
|
|
|
||||||
63
src/components/frontend/blocks/InUniverseClock.tsx
Normal file
63
src/components/frontend/blocks/InUniverseClock.tsx
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Days the in-game clock runs ahead of real time. The in-universe "now" is
|
||||||
|
* exactly this many days past the real "now", so it advances in lockstep with
|
||||||
|
* wall-clock time and never drifts out of sync with the date picker's cap.
|
||||||
|
*/
|
||||||
|
const UNIVERSE_OFFSET_DAYS = 47_326;
|
||||||
|
|
||||||
|
const DATE_FORMAT = new Intl.DateTimeFormat("en-US", {
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
|
||||||
|
const TIME_FORMAT = new Intl.DateTimeFormat("en-US", {
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit",
|
||||||
|
hour12: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Convert a real timestamp (ms) to the in-universe equivalent. */
|
||||||
|
function toUniverseMs(realMs: number): number {
|
||||||
|
return realMs + UNIVERSE_OFFSET_DAYS * 86_400_000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Live in-universe clock shown under the sidebar logo. Ticks once a second so
|
||||||
|
* the seconds readout stays in sync with real time.
|
||||||
|
*/
|
||||||
|
export default function InUniverseClock() {
|
||||||
|
// Start null so the server and the first client render agree; the value is
|
||||||
|
// only produced client-side (after mount) to avoid a Date.now() hydration
|
||||||
|
// mismatch.
|
||||||
|
const [now, setNow] = React.useState<number | null>(null);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
setNow(toUniverseMs(Date.now()));
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
setNow(toUniverseMs(Date.now()));
|
||||||
|
}, 1000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// `now` is null until the client mounts, so the server and the first client
|
||||||
|
// render agree (no Date.now() hydration mismatch) and TypeScript narrows it
|
||||||
|
// to `number` for the formatters below.
|
||||||
|
if (now === null) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<p
|
||||||
|
className="mx-auto mt-1.5 text-center text-[11px] leading-none text-muted-foreground tabular-nums group-data-[collapsible=icon]:hidden"
|
||||||
|
aria-label="In-universe timestamp"
|
||||||
|
>
|
||||||
|
<span>{DATE_FORMAT.format(now)}</span>
|
||||||
|
<span> · </span>
|
||||||
|
{TIME_FORMAT.format(new Date(now))}
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue