Skip to content

Commit

Permalink
Merge pull request #84 from Pho86/uncache
Browse files Browse the repository at this point in the history
update readme, uncache index page, and readjust navbar anim
  • Loading branch information
Pho86 authored Jun 11, 2024
2 parents 169bde1 + a3f6e34 commit 5fa4fdb
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 47 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Tenryou is a companion website create for the action-rpg game [Genshin Impact](h
- [ ] Japanese
- [ ] Chinese
- [ ] Korean
- [ ] Etc...
- [ ] HSR/ZZZ support
- [ ] Discord Bot

## Development
Tenryou is create via Next.js and information is pulled using axios by these sources:
Expand Down Expand Up @@ -89,14 +91,15 @@ Contribute by reporting a bug/suggesting an enhancement
3. Give it an appropriate label
4. Thank you for your contribution!

Contribute through development
Contribute through development,

1. Fork the Project
2. Create your Feature Branch (`git checkout -b Feature`)
3. Commit your Changes (`git commit -m 'Add some Feature'`)
4. Push to the Branch (`git push origin Feature`)
5. Open a Pull Request with a clear and concise title and description.
6. Thank you for your contribution!
1. Create an issue before contributing
2. Fork the Project
3. Create your Feature Branch (`git checkout -b Feature`)
4. Commit your Changes (`git commit -m 'Add some Feature'`)
5. Push to the Branch (`git push origin Feature`)
6. Open a Pull Request with a clear and concise title and description.
7. Thank you for your contribution!


## License
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Birthdays/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function Birthdays({ }: {}) {
<option value="December" id="December">December</option>
</select>
</label>
<div className="p-2 justify-center grid-auto-fit-150">
<div className="p-2 justify-center grid-auto-fit-100">
{loading ?
<Loader />
:
Expand Down
40 changes: 28 additions & 12 deletions src/app/components/DailyDomains/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function DailyDomains({ }: {}) {
};
const [done, setDone] = useState<boolean>(false)
const weekday: string[] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

useLayoutEffect(() => {
setLoading(true);
let day = selectedDay;
Expand All @@ -63,10 +64,12 @@ export default function DailyDomains({ }: {}) {
day = weekday[d.getDay()];
setSelectedDay(day);
setDone(true);
setActiveCharacters([]);
}
const storedData = sessionStorage.getItem(`domainData_${selectedDay}`);
if (storedData) {
const parsedData = JSON.parse(storedData);
setActiveCharacters([]);
setActiveWeapons(parsedData.weapons);
setActiveArtifacts([]);
fetchAndSetData(parsedData.allData);
Expand Down Expand Up @@ -97,6 +100,7 @@ export default function DailyDomains({ }: {}) {
}
}
}, [selectedDay]);

return (<div className="overflow-y-scroll h-full p-2 gap-2 flex flex-col">
<label className="w-full" htmlFor="days">
<span className="hidden">Days of the Week</span>
Expand Down Expand Up @@ -125,18 +129,30 @@ export default function DailyDomains({ }: {}) {
<Image src={`https://enka.network/ui/UI_ItemIcon_${domain.rewardPreview[domain.rewardPreview.length - 1].id}.png`} width={75} height={75} alt={` material icon`} className={`bg-gradient-to-br from-gradient-SSR-start to-gradient-SSR-end rounded-xl hover:scale-105 hover:shadow-light transition-all`} title={`${domain.rewardPreview[domain.rewardPreview.length - 1].name}`} />
</div>
<div className="grid-auto-fit-10">
{activeCharacters.length > 1 && activeCharacters[index].map((character: Character, i: number) => {
return <Link id={`${character.name}_daily`} key={i} className="cursor-pointer max-w-12 min-h-4" href={`/characters/${character.name}`}>
<Image
src={`https://enka.network/ui/UI_AvatarIcon_${character.fileName}.png`}
width={200}
height={200}
alt={`${character.name}`}
title={`${character.name}`}
className={`w-full hover:scale-105 hover:shadow-light transition-all rounded-xl object-cover bg-gradient-to-br ${character.rarity == 4 ? " from-gradient-SR-start to-gradient-SR-end" : "from-gradient-SSR-start to-gradient-SSR-end"}`}
/>
</Link>
})}
{activeCharacters.length > 1 ?
<>
{activeCharacters[index].map((character: Character, i: number) => {
return (
<Link id={`${character.name}_daily`} key={i} className="cursor-pointer max-w-12 min-h-4" href={`/characters/${character.name}`}>
<Image
src={`https://enka.network/ui/UI_AvatarIcon_${character.fileName}.png`}
width={200}
height={200}
alt={`${character.name}`}
title={`${character.name}`}
className={`w-full hover:scale-105 hover:shadow-light transition-all rounded-xl object-cover bg-gradient-to-br ${character.rarity == 4 ? " from-gradient-SR-start to-gradient-SR-end" : "from-gradient-SSR-start to-gradient-SSR-end"
}`}
/>
</Link>
);
})}
</> : index === 0 ?
<div className="col-span-full row-span-full">
<Loader />
</div>
:
null
}
</div>
</div>
})}
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/Lists/AchievementsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default function AchievementsList({
</label>
</div>
<section className="grid md:grid-cols-[30%_70%] gap-4 flex-col w-full p-2">
<div className="flex flex-col gap-4 font-bold text-xl p-5 max-h-[30dvh] md:max-h-[100dvh] overflow-y-scroll ">
<div className="flex flex-col gap-4 font-bold text-xl p-4 max-h-[30dvh] md:max-h-[100dvh] overflow-y-scroll ">
{AchievementGroups.map((group: any, index: number) => (
<div onClick={() => { setActiveGroup(group); setSearch("") }} className={`flex gap-2 rounded-xl p-2 transition-all bg-bg-dark items-center hover:scale-105 hover:shadow-light ${groupsActivated && activeGroup == group && "scale-105 shadow-light"}`} key={index}>
<div onClick={() => { setActiveGroup(group); setSearch("") }} className={`flex gap-2 rounded-xl p-2 transition-all bg-bg-dark items-center hover:scale-[102%] hover:shadow-light ${groupsActivated && activeGroup == group && "scale-[102%] shadow-light"}`} key={index}>
{group}&nbsp;
</div>
))}
Expand Down
19 changes: 1 addition & 18 deletions src/app/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { motion, useMotionValueEvent, useScroll } from "framer-motion";
import { useState, useEffect } from "react";
import { useState } from "react";
import { usePathname } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
Expand Down Expand Up @@ -53,10 +53,6 @@ export default function NavBar() {
if (pathname.includes("/characters")) pathname = "/characters";
if (pathname.includes("/users")) pathname = "/users";

const [hoveredPath, setHoveredPath] = useState(pathname);
useEffect(() => {
setHoveredPath(pathname)
}, [pathname])
return (
<>
<motion.nav className="w-full hidden px-8 md:px-16 md:flex justify-center z-[1000] bg-bg-darker items-center py-2 rounded-lg fixed "
Expand All @@ -83,20 +79,8 @@ export default function NavBar() {
className={`px-4 py-2 rounded-xl w-full font-semibold h-full relative duration-300 ease-in ${isActive ? "text-primary" : "text-text"} hover:text-accent`}
data-active={isActive}
href={item.path}
onMouseOver={() => setHoveredPath(item.path)}
>
<span>{item.name}</span>
{item.path === hoveredPath && (
<motion.div
className="absolute bottom-0 left-0 h-full bg-bg-lighter rounded-xl -z-10 w-full"
layoutId="navbar"
aria-hidden="true"
transition={{
duration: 0.3,
ease: "easeInOut"
}}
/>
)}
</Link>
);
})}
Expand All @@ -113,7 +97,6 @@ export default function NavBar() {
className={`px-4 py-2 rounded-xl w-full font-semibold text-center flex flex-col items-center justify-center h-full relative transition-all ease-in ${isActive ? "text-primary" : "text-text"} hover:text-accent`}
data-active={isActive}
href={item.path}
onMouseOver={() => setHoveredPath(item.path)}
>
<Image src={item.icon} width={30} height={30} alt="Home Icon" className=" h-10 w-10" />
<h3 className=" group-hover:text-primary relative font-normal transition-all">{item.altname ? item.altname : item.name}</h3>
Expand Down
9 changes: 6 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import Birthdays from "./components/Birthdays";


export default async function Home() {
const response = await fetch(`https://api.ambr.top/assets/data/event.json`);
const response = await fetch(`https://api.ambr.top/assets/data/event.json`, {
cache: 'no-cache'
});

if (!response.ok) {
throw new Error("failed to fetch")
}
Expand All @@ -29,7 +32,7 @@ export default async function Home() {
},
{
title: 'Current Events',
children: <Events Events={EventsData}/>
children: <Events Events={EventsData} />
},
{
title: 'Users',
Expand Down Expand Up @@ -113,7 +116,7 @@ export default async function Home() {
link: "/credits",
description: "Find Information about the changelog and credits of Tenryou."
},

]

return (
Expand Down
6 changes: 3 additions & 3 deletions src/app/teambuilder/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default async function TeamBuilderPage() {
<>
<h1 className="text-3xl text-primary">Team Builder (Beta)</h1>

{/* <Suspense fallback={<Loader />}> */}
<TeamBuilder CharacterData={characterData} />
{/* </Suspense> */}
<Suspense fallback={<Loader />}>
<TeamBuilder CharacterData={characterData} />
</Suspense>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useState } from "react"
import Link from "next/link";
export default function UserPage() {
const [user, setUser] = useState<any>({
const [user, setUser] = useState({
uid: '' as string
});
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
Expand Down

0 comments on commit 5fa4fdb

Please sign in to comment.