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 ical, { VEvent } from 'node-ical';
|
||||||
import CategoryChart from '@/components/CategoryChart'; // <-- Importieren
|
import CategoryChart from '@/components/CategoryChart';
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
params: Promise<{
|
params: Promise<{
|
||||||
@@ -45,7 +45,11 @@ export default async function EvaluationPage({ params }: PageProps) {
|
|||||||
|
|
||||||
const response = await fetch(icalUrl, { next: { revalidate: 3600 } });
|
const response = await fetch(icalUrl, { next: { revalidate: 3600 } });
|
||||||
if (!response.ok) {
|
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();
|
const icalData = await response.text();
|
||||||
@@ -78,51 +82,63 @@ export default async function EvaluationPage({ params }: PageProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
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' }}>
|
<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 ? (
|
{Object.keys(times).length === 0 ? (
|
||||||
<p>Keine Zeiten erfasst.</p>
|
<p>Keine Zeiten erfasst.</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<CategoryChart times={times} />
|
<CategoryChart times={times} />
|
||||||
|
|
||||||
<table style={{ width: '100%', borderCollapse: 'collapse', textAlign: 'left', marginTop: '1.5rem' }}>
|
{/* Responsive Container für die Tabelle */}
|
||||||
<thead>
|
<div style={{ width: '100%', overflowX: 'auto', marginTop: '1.5rem', WebkitOverflowScrolling: 'touch' }}>
|
||||||
<tr style={{ borderBottom: '2px solid #e5e7eb' }}>
|
<table style={{ width: '100%', minWidth: '480px', borderCollapse: 'collapse', textAlign: 'left' }}>
|
||||||
<th style={{ padding: '0.5rem' }}>Kategorie</th>
|
<thead>
|
||||||
<th style={{ padding: '0.5rem' }}>Dauer</th>
|
<tr style={{ borderBottom: '2px solid #e5e7eb' }}>
|
||||||
<th style={{ padding: '0.5rem' }}>Anteil</th>
|
<th style={{ padding: '0.5rem' }}>Kategorie</th>
|
||||||
</tr>
|
<th style={{ padding: '0.5rem' }}>Dauer</th>
|
||||||
</thead>
|
<th style={{ padding: '0.5rem' }}>Anteil</th>
|
||||||
<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>
|
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
<tfoot>
|
{Object.entries(times).map(([category, minutes]) => (
|
||||||
<tr style={{ fontWeight: 'bold' }}>
|
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
|
||||||
<td style={{ padding: '0.5rem' }}>Total</td>
|
<td style={{ padding: '0.5rem' }}>{category}</td>
|
||||||
<td style={{ padding: '0.5rem' }}>
|
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
|
||||||
{Math.floor(total / 60)} Std. {Math.round(total % 60)} Min. ({Math.round(total)} Min. gesamt)
|
{Math.floor(minutes / 60)} Std. {Math.round(minutes % 60)} Min. ({Math.round(minutes)} Min. gesamt)
|
||||||
</td>
|
</td>
|
||||||
<td style={{ padding: '0.5rem' }}>100%</td>
|
<td style={{ padding: '0.5rem' }}>
|
||||||
</tr>
|
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
|
||||||
</tfoot>
|
</td>
|
||||||
</table>
|
</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>
|
</section>
|
||||||
|
|
||||||
<h2>Termine ({events.length})</h2>
|
<h2 style={{ fontSize: '1.25rem', fontWeight: 600, marginBottom: '1rem' }}>Termine ({events.length})</h2>
|
||||||
{events.length === 0 ? (
|
{events.length === 0 ? (
|
||||||
<p>Keine Termine gefunden.</p>
|
<p>Keine Termine gefunden.</p>
|
||||||
) : (
|
) : (
|
||||||
@@ -132,27 +148,51 @@ export default async function EvaluationPage({ params }: PageProps) {
|
|||||||
const endDate = getIcalDate(event.end);
|
const endDate = getIcalDate(event.end);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={event.uid || index} style={{ border: '1px solid #ccc', padding: '1rem', borderRadius: '8px' }}>
|
<li
|
||||||
<h3 style={{ margin: '0 0 0.5rem 0' }}>{getIcalText(event.summary)}</h3>
|
key={event.uid || index}
|
||||||
<p>
|
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>Start:</strong> {startDate.toLocaleString('de-DE')} <br />
|
||||||
<strong>Ende:</strong> {endDate.toLocaleString('de-DE')}
|
<strong>Ende:</strong> {endDate.toLocaleString('de-DE')}
|
||||||
</p>
|
</p>
|
||||||
{event.location && <p><strong>Ort:</strong> {getIcalText(event.location)}</p>}
|
{event.location && (
|
||||||
{event.description && <p><strong>Beschreibung:</strong> {getIcalText(event.description)}</p>}
|
<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 && (
|
{event.categories && (
|
||||||
<div>
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '0.35rem',
|
||||||
|
marginTop: '0.5rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<strong>Kategorien: </strong>
|
<strong>Kategorien: </strong>
|
||||||
{getCategories(event.categories).map((cat, i) => (
|
{getCategories(event.categories).map((cat, i) => (
|
||||||
<span
|
<span
|
||||||
key={i}
|
key={i}
|
||||||
style={{
|
style={{
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
background: '#e5e7eb',
|
background: '#white',
|
||||||
color: '#111827',
|
border: '1px solid #e5e7eb',
|
||||||
|
color: 'black',
|
||||||
padding: '2px 8px',
|
padding: '2px 8px',
|
||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
marginRight: '0.5rem',
|
|
||||||
fontSize: '0.85rem',
|
fontSize: '0.85rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in new issue
Block a user