1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-09-24 03:18:28 +02:00

Add news modal to Footer component and handle offline fetch in Home component

This commit is contained in:
Nayam Amarshe 2024-01-15 19:14:44 +05:30
parent 21e77b0fd2
commit 509f03d96d
2 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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 (