Add new styles for home and landing pages

- Created home.css with comprehensive styles for the home page layout, including typography, buttons, and responsive design adjustments.
- Created landing.css to style the landing page, focusing on typography, layout, and responsive behavior for various screen sizes.
This commit is contained in:
syntaxbullet
2026-09-04 11:50:24 +02:00
parent 1acf016169
commit 084603bb6e
43 changed files with 7191 additions and 65 deletions

48
src/lib/dashboard.ts Normal file
View File

@@ -0,0 +1,48 @@
import type { HabitService } from "../habits/service";
import type { Schedule } from "../habits/contracts";
export type TodayHabit = ReturnType<HabitService["day"]>;
export type TodayResponse = {
date: string;
timezone: string;
habits: TodayHabit[];
due: number;
completed: number;
};
export async function habitRequest<T>(
path: string,
options?: RequestInit,
): Promise<T> {
const response = await fetch(`/api${path}`, options);
if (!response.ok) {
if (response.status === 401)
throw new Error("Your session has expired. Sign in again to continue.");
const body = await response.json().catch(() => null);
throw new Error(
body?.error || "Could not reach your workspace. Please try again.",
);
}
return response.status === 204
? (undefined as T)
: (response.json() as Promise<T>);
}
export function scheduleLabel(schedule?: Schedule) {
if (!schedule || schedule.type === "daily") return "Every day";
if (schedule.type === "weekdays")
return schedule.days
.map((day) => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][day])
.join(", ");
if (schedule.type === "interval") return `Every ${schedule.every} days`;
return `Every ${schedule.every === 1 ? "week" : `${schedule.every} weeks`} · ${["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][schedule.weekday]}`;
}
export function formatTrackingDate(date: string) {
return new Date(`${date}T12:00:00Z`).toLocaleDateString("en", {
weekday: "long",
month: "long",
day: "numeric",
timeZone: "UTC",
});
}