fix(frontend): resolve linting errors and component duplication

This commit is contained in:
2026-06-04 11:30:18 +02:00
parent b763aa1e9d
commit 32d3e86d38
6 changed files with 42 additions and 21 deletions
+13
View File
@@ -0,0 +1,13 @@
import React from 'react';
const Footer: React.FC = () => {
return (
<footer className="py-4 text-center">
<p className="text-xs text-slate-500">
v{__APP_VERSION__} ({__APP_GITSHA__})
</p>
</footer>
);
};
export default Footer;
@@ -100,8 +100,8 @@ const DailySummary: React.FC<DailySummaryProps> = ({ from_date, to_date, day_sta
width={60}
/>
<Tooltip
formatter={(value: any, name: any) => [
formatMinutes(Math.round(Number(value ?? 0) * 60)),
formatter={(value: number | string | readonly (string | number)[] | undefined, name: string | number | undefined) => [
formatMinutes(Math.round(Number((Array.isArray(value) ? value[0] : value ?? 0) * 60))),
name === 'daySleep' ? 'Day' : 'Night',
]}
/>
@@ -52,7 +52,8 @@ const Timetable = ({ from_date, to_date, day_start, day_end }: TimetableProps) =
useEffect(() => {
if (days.length > 0) {
setSelectedDayIndex(days.length - 1);
const newIndex = days.length - 1;
setSelectedDayIndex(prev => (prev !== newIndex ? newIndex : prev));
}
}, [days]);
+1 -1
View File
@@ -1,4 +1,4 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { createContext, useState, useEffect, ReactNode } from 'react';
const STORAGE_KEY = 'baby-sleep-settings';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useContext } from 'react';
import { SettingsContext, Settings } from './SettingsProvider';
import { SettingsContext } from './SettingsProvider';
export function useSettings() {
const context = useContext(SettingsContext);
+7
View File
@@ -3,9 +3,16 @@ import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
const APP_VERSION = process.env.VITE_APP_VERSION || 'unknown';
const APP_GITSHA = process.env.VITE_APP_GITSHA || 'unknown';
export default defineConfig({
base: './',
plugins: [react(), tailwindcss()],
define: {
__APP_VERSION__: JSON.stringify(APP_VERSION),
__APP_GITSHA__: JSON.stringify(APP_GITSHA),
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),