mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-12 01:40:53 +01:00
Add news modal to Footer component and handle offline fetch in Home component
This commit is contained in:
parent
21e77b0fd2
commit
509f03d96d
@ -1,8 +1,17 @@
|
|||||||
|
import { showNewsModalAtom } from "@/atoms/newsAtom";
|
||||||
|
import { useAtomValue, useSetAtom } from "jotai";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
function Footer() {
|
function Footer() {
|
||||||
|
const setShowNewsModal = useSetAtom(showNewsModalAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-2 text-center text-xs text-base-content/50">
|
<div className="p-2 text-center text-xs text-base-content/50">
|
||||||
|
<button
|
||||||
|
className="badge badge-neutral mb-2"
|
||||||
|
onClick={() => setShowNewsModal(true)}>
|
||||||
|
UPSCAYL NEWS
|
||||||
|
</button>
|
||||||
<p>
|
<p>
|
||||||
Copyright © {new Date().getFullYear()} -{" "}
|
Copyright © {new Date().getFullYear()} -{" "}
|
||||||
<a
|
<a
|
||||||
|
@ -220,9 +220,9 @@ const Home = () => {
|
|||||||
|
|
||||||
// FETCH NEWS
|
// FETCH NEWS
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// TODO: Disable on no internet
|
// TODO: ADD AN ABOUT TAB
|
||||||
|
if (window && window.navigator.onLine === false) return;
|
||||||
try {
|
try {
|
||||||
return;
|
|
||||||
fetch("https://raw.githubusercontent.com/upscayl/upscayl/main/news.md", {
|
fetch("https://raw.githubusercontent.com/upscayl/upscayl/main/news.md", {
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
})
|
})
|
||||||
@ -237,7 +237,7 @@ const Home = () => {
|
|||||||
}
|
}
|
||||||
const markdownData = matter(newsData);
|
const markdownData = matter(newsData);
|
||||||
if (!markdownData) return;
|
if (!markdownData) return;
|
||||||
if (markdownData && markdownData.data.dontShow) {
|
if (markdownData && !markdownData.data.dontShow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user