Merge pull request #26 from gractwo/quickfix

fix hitching & add in frames for all fetched content
This commit is contained in:
2023-01-03 19:44:38 +01:00
committed by GitHub
8 changed files with 90 additions and 17 deletions

View File

@@ -15,11 +15,19 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
max-height: var(--mheight); max-height: var(--mheight);
animation-name: goIn;
animation-duration: 350ms;
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
text-decoration: none; text-decoration: none;
max-height: none; max-height: none;
text-align: center; text-align: center;
} }
@keyframes goIn {
from {
opacity: 0;
transform: translate(0, 8px);
}
}
img { img {
max-height: var(--mheight); max-height: var(--mheight);
border-radius: 8px; border-radius: 8px;

View File

@@ -3,6 +3,14 @@
background: var(--black1); background: var(--black1);
border-radius: 8px; border-radius: 8px;
box-shadow: var(--shadow0); box-shadow: var(--shadow0);
animation-name: goIn;
animation-duration: 350ms;
@keyframes goIn {
from {
opacity: 0;
transform: translate(0, 16px);
}
}
article { article {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@@ -8,6 +8,11 @@ import { IndexGallery } from "../components/IndexGallery/IndexGallery";
const PageIndex = () => { const PageIndex = () => {
const [splash, setSplash] = useState(""); const [splash, setSplash] = useState("");
const [memberCount, setMemberCount] = useState(""); const [memberCount, setMemberCount] = useState("");
const [daysOfExistence, setDaysOfExistence] = useState("");
const [sentMessages, setSentMessages] = useState("");
const [welcomeText, setWelcomeText] = useState(
"Witamy na witrynie internetowej Gractwa."
);
function randomizeSplash(): void { function randomizeSplash(): void {
fetch("https://gractwo.pl/api/v1/splash") fetch("https://gractwo.pl/api/v1/splash")
.then((res) => { .then((res) => {
@@ -17,6 +22,8 @@ const PageIndex = () => {
setSplash(data.Splash); setSplash(data.Splash);
}) })
.catch((err) => { .catch((err) => {
setSplash("nie ma tu co zabezpieczać");
setWelcomeText("splashtexty spadły z rowerka!");
console.log(err); console.log(err);
}); });
} }
@@ -30,10 +37,34 @@ const PageIndex = () => {
setMemberCount(data); setMemberCount(data);
}) })
.catch((err) => { .catch((err) => {
setMemberCount("∞");
console.log(err); console.log(err);
}); });
setDaysOfExistence(
Math.floor(
(Date.now() - new Date("2020-07-06").getTime()) / 86400000
).toString()
);
setSentMessages("dużo");
}, []); }, []);
const welcometext: string = "Witamy na witrynie internetowej Gractwa."; // Mamy nadzieję że odnajdziesz czego szukasz, zbłąkana duszo."; useEffect(() => {
if (!memberCount) return;
if (!daysOfExistence) return;
if (!sentMessages) return;
if (document) {
document
.querySelectorAll(".statCont > article > h1")
.forEach((el: Element) => {
el.classList.add(styles.doneLoading);
});
}
}, [memberCount, daysOfExistence, sentMessages]);
useEffect(() => {
if (!splash) return;
if (document) {
document.querySelector(".splashtext")?.classList.add(styles.doneLoading);
}
}, [splash]);
return ( return (
<> <>
<SEO /> <SEO />
@@ -41,29 +72,25 @@ const PageIndex = () => {
<div className={styles.heroinside}> <div className={styles.heroinside}>
<h1 <h1
onClick={randomizeSplash} onClick={randomizeSplash}
className={styles.h1clicktorefreshsplash} className={`${styles.actualsplash} splashtext`}
> >
&bdquo;{splash || "..."}&rdquo; &bdquo;{splash || "..."}&rdquo;
</h1> </h1>
<p>{welcometext}</p> <p>{welcomeText || "Witamy na witrynie internetowej Gractwa."}</p>
</div> </div>
</div> </div>
<div className={styles.statscontainer}> <div className={styles.statscontainer}>
<main className={styles.stats}> <main className={`${styles.stats} statCont`}>
<article> <article>
<h1>{memberCount || ""}</h1> <h1>{memberCount || "invis placeholder"}</h1>
<p>członków na discordzie</p> <p>członków na discordzie</p>
</article> </article>
<article> <article>
<h1> <h1>{daysOfExistence || "invis placeholder"}</h1>
{Math.floor(
(Date.now() - new Date("2020-07-06").getTime()) / 86400000
)}
</h1>
<p>dni istnienia gractwa</p> <p>dni istnienia gractwa</p>
</article> </article>
<article> <article>
<h1>dużo</h1> <h1>{sentMessages || "invis placeholder"}</h1>
<p>wysłanych wiadomości</p> <p>wysłanych wiadomości</p>
</article> </article>
</main> </main>

View File

@@ -19,7 +19,7 @@ const PageMe = () => {
useEffect(() => { useEffect(() => {
if (!user) return; if (!user) return;
fetch("https://gractwo.pl/api/v1/admincards") fetch("https://gractwo.pl/api/v1/persons-of-note")
.then((res) => { .then((res) => {
return res.json(); return res.json();
}) })
@@ -41,7 +41,7 @@ const PageMe = () => {
<p>Sit tight.</p> <p>Sit tight.</p>
</main> </main>
)} )}
{error && ( {!isLoading && error && (
<main> <main>
<h3>Wystąpił błąd.</h3> <h3>Wystąpił błąd.</h3>
<p>Tyle wiemy:</p> <p>Tyle wiemy:</p>

View File

@@ -14,7 +14,7 @@ const PageMeSettings = () => {
</main> </main>
</> </>
)} )}
{error && ( {!isLoading && error && (
<main> <main>
<h3>Wystąpił błąd.</h3> <h3>Wystąpił błąd.</h3>
<p>Tyle wiemy.</p> <p>Tyle wiemy.</p>

View File

@@ -92,7 +92,7 @@ const PageInfo = () => {
</main> </main>
<main id="sklad-administracji"> <main id="sklad-administracji">
<h2>skład administracji</h2> <h2>skład administracji</h2>
<div className={styles.persons}> <div className={styles.persons} style={{ minHeight: "280px" }}>
{personsList {personsList
.filter((el: apiResType) => { .filter((el: apiResType) => {
return el.IsAdmin; return el.IsAdmin;
@@ -125,7 +125,7 @@ const PageInfo = () => {
</main> </main>
<main id="osoby-godne-uwagi"> <main id="osoby-godne-uwagi">
<h2>osoby godne uwagi</h2> <h2>osoby godne uwagi</h2>
<div className={styles.persons}> <div className={styles.persons} style={{ minHeight: "128px" }}>
{personsList {personsList
.filter((el: apiResType) => { .filter((el: apiResType) => {
return !el.IsAdmin; return !el.IsAdmin;

View File

@@ -37,8 +37,14 @@
transform: scale(0.85); transform: scale(0.85);
} }
} }
.h1clicktorefreshsplash { .actualsplash {
user-select: none; user-select: none;
opacity: 0;
&.doneLoading {
opacity: 1;
animation-name: goIn;
animation-duration: 350ms;
}
&:hover { &:hover {
cursor: pointer; cursor: pointer;
} }
@@ -63,6 +69,13 @@
text-align: center; text-align: center;
h1 { h1 {
font-size: 2em; font-size: 2em;
min-height: 1em;
opacity: 0;
&.doneLoading {
opacity: 1;
animation-name: goIn;
animation-duration: 350ms;
}
} }
&:first-of-type { &:first-of-type {
border-left: none; border-left: none;
@@ -92,3 +105,12 @@
} }
} }
} }
@keyframes goIn {
from {
opacity: 0;
transform: translate(0, 20px);
}
to {
opacity: 1;
}
}

View File

@@ -61,6 +61,14 @@
border-radius: var(--radius); border-radius: var(--radius);
box-shadow: var(--shadow0); box-shadow: var(--shadow0);
transition-duration: 100ms; transition-duration: 100ms;
animation-name: goIn;
animation-duration: 200ms;
@keyframes goIn {
from {
opacity: 0;
transform: translate(0, 16px);
}
}
img { img {
width: 128px; width: 128px;
max-width: 156px; max-width: 156px;