Skip to content

Commit 04cb374

Browse files
committed
Add loading, sounds and new model
1 parent c02eb97 commit 04cb374

File tree

11 files changed

+405
-65
lines changed

11 files changed

+405
-65
lines changed

package-lock.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
"deploy": "gh-pages -d dist"
1414
},
1515
"dependencies": {
16+
"@fortawesome/free-solid-svg-icons": "^6.6.0",
17+
"@fortawesome/react-fontawesome": "^0.2.2",
1618
"@react-three/drei": "^9.114.0",
1719
"@react-three/fiber": "^8.16.6",
1820
"@vercel/analytics": "^1.3.1",
1921
"@vercel/speed-insights": "^1.0.12",
2022
"react": "^18.2.0",
2123
"react-dom": "^18.2.0",
24+
"react-router-dom": "^6.28.0",
2225
"three": "^0.164.1"
2326
},
2427
"devDependencies": {

public/Married Life.mp3

5.74 MB
Binary file not shown.
539 KB
Binary file not shown.

src/AudioPlayer.css

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.media-controls {
2+
align-items: center;
3+
background-color: rgba(255, 255, 255, 0.95);
4+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
5+
border: 1px solid #00c49a;
6+
border-radius: 12px;
7+
display: flex;
8+
flex-direction: column;
9+
justify-content: center;
10+
padding: 16px;
11+
position: absolute; /* Change from relative to absolute */
12+
top: 20px; /* Adjust to position it at the top */
13+
left: 20px; /* Adjust to position it at the left */
14+
z-index: 1000; /* Ensure it appears above other content */
15+
margin: 0; /* Remove margin to avoid unwanted space */
16+
}
17+
18+
.media-buttons {
19+
display: flex;
20+
flex-wrap: nowrap;
21+
}
22+
23+
.media-button {
24+
background-color: transparent;
25+
border: none;
26+
align-items: center;
27+
border-radius: 50%;
28+
display: flex;
29+
flex-direction: column;
30+
justify-content: center;
31+
padding: 10px;
32+
text-align: center;
33+
font-family: "Satoshi", sans-serif;
34+
transition: background-color 0.3s, color 0.3s; /* Smooth color transition */
35+
}
36+
37+
.media-button:hover {
38+
background-color: #007bff; /* Blue background on hover */
39+
.button-text {
40+
color: #fff; /* White text on hover */
41+
}
42+
.button-icons {
43+
background-color: #fff; /* White background on hover */
44+
color: #007BFF; /* Blue text on hover */
45+
}
46+
}
47+
48+
.button-text {
49+
color: #007BFF;
50+
}
51+
52+
.button-icons {
53+
background-color: #007BFF;
54+
border-radius: 50%;
55+
margin-bottom: 5px;
56+
padding: 12px;
57+
}
58+
59+
.play-button .button-icons {
60+
border: 1px solid #007BFF;
61+
}
62+
63+
.media-progress {
64+
align-self: stretch;
65+
display: flex;
66+
flex-wrap: wrap;
67+
justify-content: space-between;
68+
margin-top: 10px;
69+
}
70+
71+
.progress-bar-wrapper {
72+
background-color: transparent;
73+
border-radius: 5px;
74+
height: 5px;
75+
width: 100%;
76+
position: relative;
77+
}
78+
79+
.progress-bar {
80+
background: linear-gradient(to right, #00c49a, #007BFF);
81+
height: 5px;
82+
width: 50%; /* Update based on time progress */
83+
}
84+
85+
.progress-time-current,
86+
.progress-time-total {
87+
font-size: 12px;
88+
}
89+
90+
.audio-player {
91+
max-width: 500px;
92+
margin: 0 auto;
93+
}

src/Components/Home.jsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@ import '../styles.css';
88
import steps from '../Utils/steps.json';
99
import WalkthroughUI from './WalkthroughUI';
1010
import WalkthroughController from '../Controllers/WalkthroughController';
11-
import Loading from '../Utils/Loading'; // Import the Loading component
11+
import Loading from '../Utils/Loading';
1212
import { SpeedInsights } from '@vercel/speed-insights/react';
13-
import { Analytics } from "@vercel/analytics/react"
13+
import { Analytics } from "@vercel/analytics/react";
1414
import * as THREE from 'three';
1515
import { SoftShadows } from '@react-three/drei';
16+
import AudioPlayer from '../Utils/AudioPlayer';
1617

1718
function Home() {
1819
const modelRef = useRef();
1920
const Model = React.lazy(() => import('./Model'));
2021
const [currentStep, setCurrentStep] = useState(0);
2122
const [isTransitioning, setIsTransitioning] = useState(false);
2223
const [completedEvents, setCompletedEvents] = useState({});
23-
const [isLoading, setIsLoading] = useState(true); // Loading state
24+
const [isLoading, setIsLoading] = useState(true);
2425
const [isWalkthroughActive, setIsWalkthroughActive] = useState(true);
2526
const [pcZoomed, setPcZoomed] = useState(false);
2627

2728
const exitWalkthrough = () => {
28-
setIsWalkthroughActive(false); // Or any logic to hide the walkthrough
29+
setIsWalkthroughActive(false);
2930
};
3031

3132
const { description, events } = steps[currentStep] || {};
@@ -44,43 +45,34 @@ function Home() {
4445
if (!isTransitioning && currentStep > 0) {
4546
setCurrentStep((prev) => prev - 1);
4647
}
47-
}
48+
};
4849

4950
const completeEvent = (eventName, stepIndex) => {
50-
// TODO: wait till lerp animation is done
5151
if (isTransitioning) {
5252
return;
5353
}
54-
// Ensure that the event only completes if it's the correct step
5554
if (stepIndex !== currentStep) {
5655
return;
5756
}
58-
59-
// Check if the event is already completed for the given step
6057
setCompletedEvents((prev) => {
6158
const isEventAlreadyCompleted = prev[stepIndex]?.[eventName];
62-
6359
if (isEventAlreadyCompleted) {
64-
return prev; // Event is already completed, so return previous state
60+
return prev;
6561
}
66-
67-
// If not completed, create a new state object
6862
const updatedEvents = {
6963
...prev,
7064
[stepIndex]: {
7165
...prev[stepIndex],
7266
[eventName]: true,
7367
},
7468
};
75-
76-
// Check if all events for the current step are now completed
7769
const stepEvents = steps[stepIndex]?.events || {};
7870
const allEventsCompleted = Object.keys(stepEvents).every(
7971
(event) => updatedEvents[stepIndex]?.[event] === true
8072
);
8173

8274
if (allEventsCompleted) {
83-
nextStep(); // Move to the next step if all events are completed
75+
nextStep();
8476
}
8577

8678
return updatedEvents;
@@ -93,8 +85,9 @@ function Home() {
9385

9486
return (
9587
<div className="container">
96-
<Suspense fallback={<Loading />}>
88+
<Suspense fallback={<Loading isLoading={isLoading} />}>
9789
{isLoading && <Loading />}
90+
<AudioPlayer />
9891
<Canvas shadows={{ type: THREE.PCFSoftShadowMap, mapSize: { width: 2048, height: 2048 } }} precision="high">
9992
{!isWalkthroughActive && <Lighting />}
10093
<SoftShadows size={20} samples={16} />
@@ -108,7 +101,6 @@ function Home() {
108101
setPcZoomed={setPcZoomed}
109102
/>
110103
<OrbitControls enableZoom={false} enablePan={false} enableRotate={false} />
111-
{/* <Stats /> */}
112104
<ModelController
113105
modelRef={modelRef}
114106
isWalkthroughActive={isWalkthroughActive}

0 commit comments

Comments
 (0)