Skip to content

Commit

Permalink
Merge pull request #17 from esc-chula/neen/mute-button
Browse files Browse the repository at this point in the history
Mute Button
  • Loading branch information
MasterIceZ authored Sep 4, 2024
2 parents 749e86e + fe811be commit c1154d3
Show file tree
Hide file tree
Showing 55 changed files with 556 additions and 47 deletions.
70 changes: 42 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added src/assets/story/scene-3/01.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/02.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/03.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/04.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/05.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/06.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/07.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/08.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/09.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/10.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/11.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/12.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/13.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/14.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/15.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/16.webp
Binary file not shown.
Binary file added src/assets/story/scene-3/17.webp
Binary file not shown.
Binary file added src/assets/ui/muteIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/ui/unmuteIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/components/MuteButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useEffect, useState } from "react";

import { settings } from "@/stores/settingsStores";

import MuteImage from "@/assets/ui/muteIcon.png";
import UnmuteImage from "@/assets/ui/unmuteIcon.png";

const MuteButton = () => {
const [mute, setMute] = useState<string>("false");

useEffect(() => {
setMute(settings.get().mute);
}, []);

const handleClick = () => {
settings.setKey("mute", settings.get().mute === "true" ? "false" : "true");
setMute(settings.get().mute);
};

return (
<div
onClick={handleClick}
className="absolute right-5 top-5 z-[999] cursor-pointer select-none"
>
{mute === "true" ? (
<img className="h-10 w-10" src={UnmuteImage.src} alt="unmute" />
) : (
<img className="h-10 w-10" src={MuteImage.src} alt="mute" />
)}
</div>
);
};

export default MuteButton;
2 changes: 1 addition & 1 deletion src/components/StartingScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const StartingScene = () => {
}}
className="absolute z-0"
/>
{lastImage && <Tap delay={0.5} redirectUrl="/story/0-03" />}
{lastImage && <Tap delay={0.5} redirectUrl="/story/0-02" />}
</>
);
};
Expand Down
3 changes: 0 additions & 3 deletions src/components/inputs/AnswerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const AnswerButton = ({
redirectUrl: string;
}) => {
const handleClick = () => {
// TODO: Implement stores
console.log(`You clicked the ${attribute} button!`);

const currentScoreStr = userAnswer.get()[attribute] || "0";
const currentScore = parseInt(currentScoreStr, 10);
userAnswer.setKey(attribute, (currentScore + 1).toString());
Expand Down
8 changes: 3 additions & 5 deletions src/components/start/ResetScores.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useStore } from "@nanostores/react";

import { userAnswer } from "@/stores/userAnswerStores";
import { settings } from "@/stores/settingsStores";

const ResetScores = () => {
const answers = useStore(userAnswer);
// TODO: RESET SCORE
settings.setKey("mute", "false");
// TODO: RESET SCORES
return null;
};

Expand Down
6 changes: 4 additions & 2 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import "@fontsource/chakra-petch/700.css";
import { ViewTransitions } from "astro:transitions";
import MuteButton from "@/components/MuteButton";
interface Props {
title?: string;
}
Expand All @@ -26,8 +28,8 @@ const { title = "Astro APP" } = Astro.props;
</head>
<body>
<main
class="absolute left-1/2 -z-50 flex min-h-dvh w-full max-w-md -translate-x-1/2 overflow-hidden bg-gray-100"
>
class="absolute left-1/2 -z-50 flex min-h-dvh w-full max-w-md -translate-x-1/2 overflow-hidden bg-gray-100">
<MuteButton client:load />
<slot />
</main>
</body>
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import BaseLayout from "@/layouts/BaseLayout.astro";
import TextBubble from "@/components/TextBubble";
---

<BaseLayout>
Expand Down
8 changes: 3 additions & 5 deletions src/pages/story/0-02.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import BackgroundImage from "@/assets/story/scene-0/07.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<a
href="/story/0-03"
class="absolute bottom-1/4 right-8 z-50 rounded-full bg-yellow-100 bg-opacity-70 p-12 text-black hover:cursor-pointer"
>Tap</a
>
<Tap delay={0.5} redirectUrl="/story/0-03" client:load />
</ImagePageLayout>
3 changes: 1 addition & 2 deletions src/pages/story/0-03.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import BackgroundLowRes from "@/assets/story/scene-0/08-low.webp";
<ImagePageLayout
backgroundColor="bg-[#303030]"
image={BackgroundImage}
imageLowRes={BackgroundLowRes}
>
imageLowRes={BackgroundLowRes}>
<Tap delay={0.5} redirectUrl="/story/0-04" client:load />
</ImagePageLayout>
2 changes: 1 addition & 1 deletion src/pages/story/0-07.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ import BackgroundImage from "@/assets/story/scene-0/12.webp";
className="bg-chathai"
/>
</div>
<NameInput redirectUrl="/story/0-08" client:only />
<NameInput redirectUrl="/story/0-08" client:load />
</ImagePageLayout>
18 changes: 18 additions & 0 deletions src/pages/story/3-01.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import BackgroundImage from "@/assets/story/scene-3/01.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<div class="absolute top-20 flex w-full justify-center">
<div class="h-fit w-80 select-none rounded-xl border-4 bg-white border-white">
<div class="mb-2.5 ml-2.5 mt-2.5 break-words text-center font-semibold text-sm">
<p>"ศูนย์ปฏิบัติการแห่งอนาคต"</p>
</div>
</div>
</div>
<Tap delay={0.5} redirectUrl="/story/3-02" client:load />
</ImagePageLayout>
19 changes: 19 additions & 0 deletions src/pages/story/3-02.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import TextBubble from "@/components/TextBubble";
import BackgroundImage from "@/assets/story/scene-3/02.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<div class="absolute top-20 flex w-full justify-center">
<TextBubble
name="ชาไทย"
text={"นั่น ลองเข้าไปขอความช่วยเหลือเรื่องสัญญาณจาก “Engine” ผู้ดูแลศูนย์ปฏิบัติการแห่งนี้ กันดีกว่า"}
className="bg-chathai"
/>
</div>
<Tap delay={0.5} redirectUrl="/story/3-03" client:load />
</ImagePageLayout>
19 changes: 19 additions & 0 deletions src/pages/story/3-03.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import TextBubble from "@/components/TextBubble";
import BackgroundImage from "@/assets/story/scene-3/03.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<div class="absolute top-20 flex w-full justify-center">
<TextBubble
name="%USERNAME%"
text={"ช่วยด้วย เกิดปัญหาใหญ่ขึ้นแล้ว!"}
className="bg-user"
/>
</div>
<Tap delay={0.5} redirectUrl="/story/3-04" client:load />
</ImagePageLayout>
11 changes: 11 additions & 0 deletions src/pages/story/3-04.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import BackgroundImage from "@/assets/story/scene-3/04.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<Tap delay={0.5} redirectUrl="/story/3-05" client:load />
</ImagePageLayout>
20 changes: 20 additions & 0 deletions src/pages/story/3-05.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
import ImagePageLayout from "@/layouts/ImagePageLayout.astro";
import Tap from "@/components/Tap";
import TextBubble from "@/components/TextBubble";
import BackgroundImage from "@/assets/story/scene-3/05.webp";
---

<ImagePageLayout backgroundColor="bg-[#303030]" image={BackgroundImage}>
<div class="absolute top-20 flex w-full justify-center">
<TextBubble
name="%USERNAME%"
text={"ตอนนี้ที่โรงงานสัญญาณขาดหายไป เธอสามารถแก้ไขได้ไหม"}
className="bg-user"
client:only
/>
</div>
<Tap delay={0.5} redirectUrl="/story/3-06" client:load />
</ImagePageLayout>
Loading

0 comments on commit c1154d3

Please sign in to comment.