responsive design and bug fixes

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-11-04 10:01:22 +01:00
parent 13618d1fd4
commit f5670253bc
51 changed files with 992 additions and 336 deletions

View File

@@ -45,3 +45,7 @@ export const timeRanges = [
{ range: 180, title: '6mo' },
{ range: 365, title: '1y' },
] as const;
export function isMinuteIntervalEnabledByRange(range: number) {
return range === 0.3 || range === 0.6;
}

View File

@@ -0,0 +1,6 @@
import type { Profile } from '@prisma/client';
export function getProfileName(profile: Profile | undefined | null) {
if (!profile) return '';
return [profile.first_name, profile.last_name].filter(Boolean).join(' ');
}

View File

@@ -2,14 +2,16 @@ import resolveConfig from 'tailwindcss/resolveConfig';
import tailwinConfig from '../../tailwind.config';
const config = resolveConfig<any>(tailwinConfig);
export const resolvedTailwindConfig = resolveConfig(tailwinConfig);
export const theme = config.theme;
export const theme = resolvedTailwindConfig.theme;
export function getChartColor(index: number): string {
const chartColors: string[] = Object.keys(theme.colors ?? {})
const colors = theme?.colors ?? {};
const chartColors: string[] = Object.keys(colors)
.filter((key) => key.startsWith('chart-'))
.map((key) => theme.colors[key] as string);
.map((key) => colors[key])
.filter((item): item is string => typeof item === 'string');
return chartColors[index % chartColors.length]!;
}