style: fixed issues on mobiles
This commit is contained in:
1 parent
c67080a3ef
commit
cfa35036ef
1 file changed
+84
-44
@@ -1,5 +1,5 @@
|
||||
import ical, { VEvent } from 'node-ical';
|
||||
import CategoryChart from '@/components/CategoryChart'; // <-- Importieren
|
||||
import CategoryChart from '@/components/CategoryChart';
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{
|
||||
@@ -45,7 +45,11 @@ export default async function EvaluationPage({ params }: PageProps) {
|
||||
|
||||
const response = await fetch(icalUrl, { next: { revalidate: 3600 } });
|
||||
if (!response.ok) {
|
||||
return <div>Fehler beim Laden der Kalenderdaten. Status: {response.status}</div>;
|
||||
return (
|
||||
<div style={{ padding: '1rem', color: '#dc2626', fontFamily: 'system-ui, sans-serif' }}>
|
||||
Fehler beim Laden der Kalenderdaten. Status: {response.status}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const icalData = await response.text();
|
||||
@@ -78,51 +82,63 @@ export default async function EvaluationPage({ params }: PageProps) {
|
||||
});
|
||||
|
||||
return (
|
||||
<main style={{ maxWidth: '800px', margin: '0 auto', padding: '2rem', fontFamily: 'system-ui, sans-serif' }}>
|
||||
<main
|
||||
style={{
|
||||
width: '100%',
|
||||
maxWidth: '800px',
|
||||
margin: '0 auto',
|
||||
padding: '1rem',
|
||||
boxSizing: 'border-box',
|
||||
fontFamily: 'system-ui, sans-serif',
|
||||
}}
|
||||
>
|
||||
<section style={{ marginBottom: '2.5rem' }}>
|
||||
<h2>Gesamtdauer pro Kategorie</h2>
|
||||
<h2 style={{ fontSize: '1.25rem', fontWeight: 600, marginBottom: '1rem' }}>Gesamtdauer pro Kategorie</h2>
|
||||
{Object.keys(times).length === 0 ? (
|
||||
<p>Keine Zeiten erfasst.</p>
|
||||
) : (
|
||||
<>
|
||||
<CategoryChart times={times} />
|
||||
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', textAlign: 'left', marginTop: '1.5rem' }}>
|
||||
<thead>
|
||||
<tr style={{ borderBottom: '2px solid #e5e7eb' }}>
|
||||
<th style={{ padding: '0.5rem' }}>Kategorie</th>
|
||||
<th style={{ padding: '0.5rem' }}>Dauer</th>
|
||||
<th style={{ padding: '0.5rem' }}>Anteil</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.entries(times).map(([category, minutes]) => (
|
||||
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
|
||||
<td style={{ padding: '0.5rem' }}>{category}</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{Math.floor(minutes / 60)} Std. {Math.round(minutes % 60)} Min. ({Math.round(minutes)} Min. gesamt)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
{/* Responsive Container für die Tabelle */}
|
||||
<div style={{ width: '100%', overflowX: 'auto', marginTop: '1.5rem', WebkitOverflowScrolling: 'touch' }}>
|
||||
<table style={{ width: '100%', minWidth: '480px', borderCollapse: 'collapse', textAlign: 'left' }}>
|
||||
<thead>
|
||||
<tr style={{ borderBottom: '2px solid #e5e7eb' }}>
|
||||
<th style={{ padding: '0.5rem' }}>Kategorie</th>
|
||||
<th style={{ padding: '0.5rem' }}>Dauer</th>
|
||||
<th style={{ padding: '0.5rem' }}>Anteil</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style={{ fontWeight: 'bold' }}>
|
||||
<td style={{ padding: '0.5rem' }}>Total</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{Math.floor(total / 60)} Std. {Math.round(total % 60)} Min. ({Math.round(total)} Min. gesamt)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>100%</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.entries(times).map(([category, minutes]) => (
|
||||
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
|
||||
<td style={{ padding: '0.5rem' }}>{category}</td>
|
||||
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
|
||||
{Math.floor(minutes / 60)} Std. {Math.round(minutes % 60)} Min. ({Math.round(minutes)} Min. gesamt)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style={{ fontWeight: 'bold' }}>
|
||||
<td style={{ padding: '0.5rem' }}>Total</td>
|
||||
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
|
||||
{Math.floor(total / 60)} Std. {Math.round(total % 60)} Min. ({Math.round(total)} Min. gesamt)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>100%</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<h2>Termine ({events.length})</h2>
|
||||
<h2 style={{ fontSize: '1.25rem', fontWeight: 600, marginBottom: '1rem' }}>Termine ({events.length})</h2>
|
||||
{events.length === 0 ? (
|
||||
<p>Keine Termine gefunden.</p>
|
||||
) : (
|
||||
@@ -132,27 +148,51 @@ export default async function EvaluationPage({ params }: PageProps) {
|
||||
const endDate = getIcalDate(event.end);
|
||||
|
||||
return (
|
||||
<li key={event.uid || index} style={{ border: '1px solid #ccc', padding: '1rem', borderRadius: '8px' }}>
|
||||
<h3 style={{ margin: '0 0 0.5rem 0' }}>{getIcalText(event.summary)}</h3>
|
||||
<p>
|
||||
<li
|
||||
key={event.uid || index}
|
||||
style={{
|
||||
border: '1px solid #ccc',
|
||||
padding: '1rem',
|
||||
borderRadius: '8px',
|
||||
wordBreak: 'break-word', // Verhindert Überlaufen von sehr langem Text/URLs
|
||||
}}
|
||||
>
|
||||
<h3 style={{ margin: '0 0 0.5rem 0', wordBreak: 'break-word' }}>{getIcalText(event.summary)}</h3>
|
||||
<p style={{ margin: '0 0 0.5rem 0' }}>
|
||||
<strong>Start:</strong> {startDate.toLocaleString('de-DE')} <br />
|
||||
<strong>Ende:</strong> {endDate.toLocaleString('de-DE')}
|
||||
</p>
|
||||
{event.location && <p><strong>Ort:</strong> {getIcalText(event.location)}</p>}
|
||||
{event.description && <p><strong>Beschreibung:</strong> {getIcalText(event.description)}</p>}
|
||||
{event.location && (
|
||||
<p style={{ margin: '0 0 0.5rem 0' }}>
|
||||
<strong>Ort:</strong> {getIcalText(event.location)}
|
||||
</p>
|
||||
)}
|
||||
{event.description && (
|
||||
<p style={{ margin: '0 0 0.5rem 0', whiteSpace: 'pre-line' }}>
|
||||
<strong>Beschreibung:</strong> {getIcalText(event.description)}
|
||||
</p>
|
||||
)}
|
||||
{event.categories && (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
alignItems: 'center',
|
||||
gap: '0.35rem',
|
||||
marginTop: '0.5rem',
|
||||
}}
|
||||
>
|
||||
<strong>Kategorien: </strong>
|
||||
{getCategories(event.categories).map((cat, i) => (
|
||||
<span
|
||||
key={i}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
background: '#e5e7eb',
|
||||
color: '#111827',
|
||||
background: '#white',
|
||||
border: '1px solid #e5e7eb',
|
||||
color: 'black',
|
||||
padding: '2px 8px',
|
||||
borderRadius: '4px',
|
||||
marginRight: '0.5rem',
|
||||
fontSize: '0.85rem',
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user