diff --git a/frontend/src/assets/img/ash.png b/frontend/src/assets/img/ash.png new file mode 100644 index 0000000..5702a5d Binary files /dev/null and b/frontend/src/assets/img/ash.png differ diff --git a/frontend/src/assets/img/c3po.png b/frontend/src/assets/img/c3po.png new file mode 100644 index 0000000..87ecb79 Binary files /dev/null and b/frontend/src/assets/img/c3po.png differ diff --git a/frontend/src/components/CharacterBadge.tsx b/frontend/src/components/CharacterBadge.tsx new file mode 100644 index 0000000..6a3384f --- /dev/null +++ b/frontend/src/components/CharacterBadge.tsx @@ -0,0 +1,10 @@ +import React from 'react'; + +const CharacterBadge = ({ name, image, onClick }: { name: string, image: string, onClick: () => void }) => ( +
+ {name} +

{name}

+
+); + +export default CharacterBadge; \ No newline at end of file diff --git a/frontend/src/components/Progress.tsx b/frontend/src/components/Progress.tsx index cd36183..b55c032 100644 --- a/frontend/src/components/Progress.tsx +++ b/frontend/src/components/Progress.tsx @@ -8,7 +8,7 @@ interface ProgressProps { export default function Progress({percent, back}: ProgressProps) { return
- {back != null && } + {back != null && }
{percent > 0 &&
}
diff --git a/frontend/src/index.sass b/frontend/src/index.sass index 862f8ef..e1ad5b0 100644 --- a/frontend/src/index.sass +++ b/frontend/src/index.sass @@ -133,3 +133,55 @@ h1 &.active color: $c-green + +.character + display: flex + flex-direction: column + align-items: center + gap: 1em + + img + width: 150px + height: 150px + border-radius: 50% + object-fit: cover + background: $c-green + + p + font-size: 0.9em + font-weight: 800 + +.back-button + color: #a0aec0 + font-size: 1.5rem + +.record-btn + position: fixed + bottom: 20px + left: 50% + transform: translateX(-50%) + width: calc(100% - 40px) + padding: 10px 16px + +.chat-area + display: flex + flex-direction: column + width: 100% + max-width: 600px + margin: 20px auto + +.message + margin: 10px + padding: 10px + border-radius: 5px + color: white + +.message.me + align-self: flex-end + background-color: $c-blue + border-radius: 20px 0 20px 20px + +.message.other + align-self: flex-start + background-color: $c-green + border-radius: 0 20px 20px 20px \ No newline at end of file diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 6310248..7d7c446 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -10,7 +10,8 @@ import Course from "./pages/Course"; import Profile from "./pages/Profile"; import CollabLearning from './pages/CollabLearning'; import Review from './pages/Review'; -import Speaking from './pages/Speaking'; +import CharacterSelection from './pages/CharacterSelection'; +import Character from './pages/Character'; const router = createBrowserRouter([ { @@ -39,12 +40,16 @@ const router = createBrowserRouter([ }, { path: '/speaking', - element: + element: }, { path: '/profile', element: }, + { + path: '/character', + element: + } ]) const root = ReactDOM.createRoot( diff --git a/frontend/src/pages/Character.tsx b/frontend/src/pages/Character.tsx new file mode 100644 index 0000000..049a22c --- /dev/null +++ b/frontend/src/pages/Character.tsx @@ -0,0 +1,38 @@ +import { useLocation, useNavigate } from 'react-router-dom'; +import { Icon } from '@iconify/react'; +import CharacterBadge from '../components/CharacterBadge'; +import { useState } from 'react'; + +export default function Character() { + const location = useLocation(); + const navigate = useNavigate(); + const { name, image } = location.state; + + const [messages, setMessages] = useState([ + { text: 'Hello!', sender: 'me' }, + { text: 'Hi!', sender: 'other' }, + // Add more messages here + ]); + + function handleRecord() { + // handle the recording + } + + return ( +
+
+ navigate(-1)} /> +

Talk With...

+ {}}/> +
+ {messages.map((message, index) => ( +
+

{message.text}

+
+ ))} +
+ +
+
+ ) +} \ No newline at end of file diff --git a/frontend/src/pages/CharacterSelection.tsx b/frontend/src/pages/CharacterSelection.tsx new file mode 100644 index 0000000..48ea18c --- /dev/null +++ b/frontend/src/pages/CharacterSelection.tsx @@ -0,0 +1,38 @@ +import NavBar from "../components/NavBar" +import Ash from "../assets/img/ash.png" +import C3PO from "../assets/img/c3po.png" +import { useNavigate } from "react-router-dom" +import CharacterBadge from "../components/CharacterBadge" + +export default function CharacterSelection() { + const navigate = useNavigate(); + + const characters = [ + { name: 'Ash', image: Ash }, + { name: 'C3PO', image: C3PO }, + // Add more characters here + ]; + + const handleCharacterClick = (characterName: string, characterImage: string) => { + navigate('/character', { state: { name: characterName, image: characterImage } }); + } + + return ( +
+
+

Talk With...

+
+ {characters.map(character => ( + handleCharacterClick(character.name, character.image)} + /> + ))} +
+
+ +
+ ) +} \ No newline at end of file diff --git a/frontend/src/pages/Speaking.tsx b/frontend/src/pages/Speaking.tsx deleted file mode 100644 index ed69c23..0000000 --- a/frontend/src/pages/Speaking.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import NavBar from "../components/NavBar" - -export default function Speaking() { - - return ( -
-
-

Speaking Page

-
- -
- ) - -} \ No newline at end of file