-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🦆🤶🏻 ↝ Merge pull request #102 from Signal-K/SGV2-10-Onboarding-enviro…
…nment 🌚🦆 ↝ [SGV2-10 SGV2-2]: Improving layout for navigation & orientation
- Loading branch information
Showing
31 changed files
with
3,014 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import Image from 'next/image'; | ||
|
||
export const RoverCharacter: React.FC<{ position: { x: number; y: number } }> = ({ position }) => { | ||
const [angle, setAngle] = useState<number>(0); | ||
const [direction, setDirection] = useState<number>(1); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(updateAnimation, 50); | ||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
const updateAnimation = () => { | ||
const newAngle = angle + 1 * direction; | ||
if (newAngle >= 10 || newAngle <= -10) { | ||
setDirection(direction * -1); | ||
} | ||
setAngle(newAngle); | ||
}; | ||
|
||
return ( | ||
<div className="absolute" style={{ left: `${position.x}px`, bottom: `${position.y}px` }}> | ||
<Image | ||
src="/assets/Inventory/Planets/rover.png" | ||
alt="Character" | ||
layout="fill" | ||
objectFit="contain" | ||
className="transform transition-transform duration-500" | ||
style={{ transform: `rotate(${angle}deg)` }} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export const PlanetCharacter: React.FC<{ position: { x: number; y: number } }> = ({ position }) => { | ||
const [angle, setAngle] = useState<number>(0); | ||
const [direction, setDirection] = useState<number>(1); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(updateAnimation, 50); | ||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
const updateAnimation = () => { | ||
const newAngle = angle + 1 * direction; | ||
if (newAngle >= 10 || newAngle <= -10) { | ||
setDirection(direction * -1); | ||
} | ||
setAngle(newAngle); | ||
}; | ||
|
||
return ( | ||
<div className="absolute" style={{ left: `${position.x}px`, bottom: `${position.y}px` }}> | ||
<Image | ||
src="/assets/Inventory/Planets/Mars.png" | ||
alt="Character" | ||
layout="fill" | ||
objectFit="contain" | ||
className="transform transition-transform duration-500" | ||
style={{ transform: `rotate(${angle}deg)` }} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PlanetCharacter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useSupabaseClient } from "@supabase/auth-helpers-react"; | ||
import Link from "next/link"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
export default function PublicSectorsGrid() { | ||
const supabase = useSupabaseClient(); | ||
|
||
const [sectors, setSectors] = useState([]); | ||
|
||
async function fetchSectors() { | ||
try { | ||
const { data, error } = await supabase | ||
.from('basePlanetSectors') | ||
.select('*') | ||
.limit(10) | ||
|
||
if (error) { | ||
console.assert('Error fetching sector data: ', error.message); | ||
return; | ||
}; | ||
|
||
setSectors(data); | ||
} catch (error) { | ||
console.error(error); | ||
}; | ||
}; | ||
|
||
useEffect(() => { | ||
fetchSectors(); | ||
}, []) | ||
|
||
return ( | ||
<div className="grid-container mb-24"> | ||
{sectors.map(( sector ) => ( | ||
<Link legacyBehavior key={sector.id} href={`/planets/sector/${sector.id}`}> | ||
<a className="sector-link"> | ||
<div className="sector-square"> | ||
{/* {sector.coverUrl && ( | ||
<img src={sector.coverUrl} alt="Sector Cover" className="sector-cover" /> | ||
)} */} | ||
</div> | ||
<style jsx>{` | ||
.grid-container { | ||
display: grid; | ||
grid-template-columns: repeat(5, 1fr); | ||
grid-auto-rows: 1fr; | ||
gap: 10px; | ||
margin-top: 20px; | ||
position: absolute; | ||
bottom: 20px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
z-index: 1; | ||
} | ||
.sector-square { | ||
width: 100px; | ||
height: 100px; | ||
border: 1px solid white; | ||
} | ||
`}</style> | ||
</a> | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.