mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-20 20:51:49 +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";
|
||||
|
||||
function Footer() {
|
||||
const setShowNewsModal = useSetAtom(showNewsModalAtom);
|
||||
|
||||
return (
|
||||
<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>
|
||||
Copyright © {new Date().getFullYear()} -{" "}
|
||||
<a
|
||||
|
@ -220,9 +220,9 @@ const Home = () => {
|
||||
|
||||
// FETCH NEWS
|
||||
useEffect(() => {
|
||||
// TODO: Disable on no internet
|
||||
// TODO: ADD AN ABOUT TAB
|
||||
if (window && window.navigator.onLine === false) return;
|
||||
try {
|
||||
return;
|
||||
fetch("https://raw.githubusercontent.com/upscayl/upscayl/main/news.md", {
|
||||
cache: "no-cache",
|
||||
})
|
||||
@ -237,7 +237,7 @@ const Home = () => {
|
||||
}
|
||||
const markdownData = matter(newsData);
|
||||
if (!markdownData) return;
|
||||
if (markdownData && markdownData.data.dontShow) {
|
||||
if (markdownData && !markdownData.data.dontShow) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user