mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 19:39:40 +02:00
Projects included: - maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing) - manacore (Expo mobile + SvelteKit web + Astro landing) - manadeck (NestJS backend + Expo mobile + SvelteKit web) - memoro (Expo mobile + SvelteKit web + Astro landing) This commit preserves the current state before monorepo restructuring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import { View, Text } from 'react-native';
|
|
import { useTheme } from '~/features/theme/ThemeProvider';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
interface WeekdayChartProps {
|
|
data: { [key: string]: number };
|
|
maxEntries?: number;
|
|
title?: string;
|
|
}
|
|
|
|
/**
|
|
* Simple chart component for displaying weekday distribution
|
|
*/
|
|
const WeekdayChart: React.FC<WeekdayChartProps> = ({ data, maxEntries = 3, title }) => {
|
|
const { isDark } = useTheme();
|
|
const { t } = useTranslation();
|
|
const textColor = isDark ? '#FFFFFF' : '#000000';
|
|
const textSecondaryColor = isDark ? '#CCCCCC' : '#666666';
|
|
const defaultTitle = t('statistics.recordings_per_weekday');
|
|
|
|
const sortedEntries = Object.entries(data)
|
|
.sort(([, a], [, b]) => b - a)
|
|
.slice(0, maxEntries);
|
|
|
|
return (
|
|
<View
|
|
style={{
|
|
paddingVertical: 12,
|
|
paddingHorizontal: 16,
|
|
}}>
|
|
<Text
|
|
style={{
|
|
fontSize: 14,
|
|
fontWeight: '500',
|
|
color: textColor,
|
|
marginBottom: 8,
|
|
}}>
|
|
{title || defaultTitle}
|
|
</Text>
|
|
{sortedEntries.map(([day, count], index) => (
|
|
<View
|
|
key={day}
|
|
style={{
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
marginBottom: 4,
|
|
}}>
|
|
<Text
|
|
style={{
|
|
fontSize: 12,
|
|
color: textSecondaryColor,
|
|
flex: 1,
|
|
}}>
|
|
{day}
|
|
</Text>
|
|
<Text
|
|
style={{
|
|
fontSize: 12,
|
|
color: textSecondaryColor,
|
|
fontWeight: '500',
|
|
}}>
|
|
{count} {t('statistics.memos')}
|
|
</Text>
|
|
</View>
|
|
))}
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default WeekdayChart;
|