diff --git a/.gitignore b/.gitignore index 990bc72..d95a4c9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,8 @@ dist-ssr /public/assets/profiles/anja.png /public/assets/profiles/kim.png /public/assets/profiles/matthias.jpg +/public/assets/dreampics/01.png +/public/assets/dreampics/02.png +/public/assets/dreampics/03.png +/public/assets/dreampics/04.png +/public/assets/dreampics/05.png diff --git a/src/App.tsx b/src/App.tsx index 120cb93..8e45fd5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,8 @@ import './App.css'; import Navbar from './components/Navbar'; -import {BrowserRouter, Routes, Route} from 'react-router-dom'; +import {BrowserRouter, Route, Routes} from 'react-router-dom'; import Feed from "./pages/Feed.tsx"; +import DreamPage from "./pages/DreamPage.tsx"; function Home() { return
Home Page
; @@ -22,15 +23,18 @@ function Profile() { export default function App() { return ( -
- - - }/> - }/> - }/> - }/> - }/> - +
+
+ + + }/> + }/> + }/> + }/> + }/> + }/> + +
); diff --git a/src/pages/DreamPage.tsx b/src/pages/DreamPage.tsx new file mode 100644 index 0000000..ae65c64 --- /dev/null +++ b/src/pages/DreamPage.tsx @@ -0,0 +1,104 @@ +// src/pages/DreamPage.tsx + +import {type NavigateFunction, useNavigate, useParams} from 'react-router-dom'; +import {mockDreams} from '../data/MockDreams'; +import MockUsers from '../data/MockUsers'; +import User from '../types/User'; +import type Dream from "../types/Dream.ts"; + +export default function DreamPage() { + const {id} = useParams<{ id: string }>(); + const navigate: NavigateFunction = useNavigate(); + + const dream: Dream | undefined = mockDreams.find(d => d.id === Number(id)); + const user: User | undefined = dream ? MockUsers.find(u => u.id === dream.userId) : undefined; + + if (!dream) { + return (
+ +

Traum nicht gefunden.

+
); + } + + return (
+ {/* Header */} +
+
+ +
+ {user && ({user.name})} +
+

+ {dream.title} +

+ {user && (

+ {user.name} •{' '} + {dream.date.toLocaleDateString('de-DE', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + })} +

)} +
+
+
+
+ + {/* Inhalt */} +
+
+
+ Traum-Beschreibung +
+

+ {dream.input} +

+
+ + {dream.ai?.interpretation && (
+
+ KI-Interpretation +
+

+ {dream.ai.interpretation} +

+
)} + +
+

Details

+
+
+ Eingabetyp + {dream.inputType} +
+
+ Datum + + {dream.date.toLocaleDateString('de-DE', { + day: '2-digit', month: '2-digit', year: 'numeric', + })} + +
+
+
+
+
); +} diff --git a/src/pages/Feed.tsx b/src/pages/Feed.tsx index 115dd29..9ff0171 100644 --- a/src/pages/Feed.tsx +++ b/src/pages/Feed.tsx @@ -3,6 +3,7 @@ import {mockDreams} from '../data/MockDreams'; import Dream from '../types/Dream'; import type User from "../types/User.ts"; import {MockUserMap} from "../data/MockUsers.ts"; +import {NavLink} from "react-router-dom"; export default function Feed() { const sortedDreams = [...mockDreams].sort((a, b) => b.date.getTime() - a.date.getTime()); @@ -13,27 +14,29 @@ export default function Feed() { {sortedDreams.map((dream: Dream) => { const user: User | undefined = MockUserMap.get(dream.userId); return ( -
  • -
    {user?.name} - {user?.name} hat geträumt: -
    -

    - {dream.title} -

    -

    {dream.input}

    -

    - {dream.date.toLocaleDateString('de-DE', { - day: '2-digit', - month: '2-digit', - year: 'numeric', - hour: '2-digit', - minute: '2-digit', - })} -

    -
  • + +
  • +
    {user?.name} + {user?.name} hat geträumt: +
    +

    + {dream.title} +

    +

    {dream.input}

    +

    + {dream.date.toLocaleDateString('de-DE', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + })} +

    +
  • +
    ) })}