mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 15:05:35 +00:00
fix: window is not defined (server)
This commit is contained in:
@@ -14,15 +14,17 @@ interface LinkFaviconProps {
|
|||||||
// The Favicon API should always return an image, so it's not really useful to keep the loader nor placeholder icon,
|
// The Favicon API should always return an image, so it's not really useful to keep the loader nor placeholder icon,
|
||||||
// but for slow connections and other random stuff, I'll keep this
|
// but for slow connections and other random stuff, I'll keep this
|
||||||
export default function LinkFavicon({
|
export default function LinkFavicon({
|
||||||
url,
|
url,
|
||||||
size = 32,
|
size = 32,
|
||||||
noMargin = false
|
noMargin = false,
|
||||||
}: LinkFaviconProps) {
|
}: LinkFaviconProps) {
|
||||||
const [isFailed, setFailed] = useState<boolean>(false);
|
const [isFailed, setFailed] = useState<boolean>(false);
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
const baseUrlApi = process.env.NEXT_PUBLIC_API_URL || (typeof window !== "undefined" && window)?.location?.origin + "/api";
|
const baseUrlApi =
|
||||||
|
process.env.NEXT_PUBLIC_API_URL ||
|
||||||
|
(typeof window !== "undefined" && window)?.location?.origin + "/api";
|
||||||
if (!baseUrlApi) {
|
if (!baseUrlApi) {
|
||||||
console.warn('Missing API URL')
|
console.warn("Missing API URL");
|
||||||
}
|
}
|
||||||
|
|
||||||
const setFallbackFavicon = () => setFailed(true);
|
const setFallbackFavicon = () => setFailed(true);
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ import LinkTag from "next/link";
|
|||||||
import PageTransition from "components/PageTransition";
|
import PageTransition from "components/PageTransition";
|
||||||
import styles from "styles/legal-pages.module.scss";
|
import styles from "styles/legal-pages.module.scss";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import Navbar from "../components/Navbar/Navbar";
|
import Navbar from "components/Navbar/Navbar";
|
||||||
import { getServerSideTranslation } from "../i18n";
|
import { getServerSideTranslation } from "../i18n";
|
||||||
import { useTranslation } from "next-i18next";
|
import { useTranslation } from "next-i18next";
|
||||||
import { TFunctionParam } from "../types/i18next";
|
import { TFunctionParam } from "types/i18next";
|
||||||
|
|
||||||
export default function Privacy() {
|
export default function Privacy() {
|
||||||
const { t } = useTranslation("privacy");
|
const { t } = useTranslation("privacy");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageTransition className={clsx("App", styles["privacy"])}>
|
<PageTransition className={clsx("App", styles["legal"])}>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<main>
|
<main>
|
||||||
<h1>{t("privacy:title")}</h1>
|
<h1>{t("privacy:title")}</h1>
|
||||||
@@ -55,9 +55,8 @@ export default function Privacy() {
|
|||||||
<p>
|
<p>
|
||||||
{t("privacy:contact.description")}{" "}
|
{t("privacy:contact.description")}{" "}
|
||||||
<LinkTag href="mailto:sonnyasdev@gmail.com" target="_blank">
|
<LinkTag href="mailto:sonnyasdev@gmail.com" target="_blank">
|
||||||
sonnyasdev[at]gmail.com
|
sonnyasdev[at]gmail[dot]com
|
||||||
</LinkTag>
|
</LinkTag>
|
||||||
.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>{t("privacy:footer.changes")}</p>
|
<p>{t("privacy:footer.changes")}</p>
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ import styles from "styles/legal-pages.module.scss";
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import LinkTag from "next/link";
|
import LinkTag from "next/link";
|
||||||
import Navbar from "components/Navbar/Navbar";
|
import Navbar from "components/Navbar/Navbar";
|
||||||
import { getServerSideTranslation } from "../i18n";
|
import { getServerSideTranslation } from "i18n";
|
||||||
import { Trans, useTranslation } from "next-i18next";
|
import { Trans, useTranslation } from "next-i18next";
|
||||||
import { TFunctionParam } from "../types/i18next";
|
import { TFunctionParam } from "types/i18next";
|
||||||
import PATHS from "constants/paths";
|
import PATHS from "constants/paths";
|
||||||
|
|
||||||
export default function Terms() {
|
export default function Terms() {
|
||||||
const { t } = useTranslation("terms");
|
const { t } = useTranslation("terms");
|
||||||
return (
|
return (
|
||||||
<PageTransition className={clsx("App", styles["privacy"])}>
|
<PageTransition className={clsx("App", styles["legal"])}>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<main>
|
<main>
|
||||||
<h1>{t("terms:title")}</h1>
|
<h1>{t("terms:title")}</h1>
|
||||||
@@ -61,9 +61,8 @@ export default function Terms() {
|
|||||||
<p>
|
<p>
|
||||||
{t("terms:contact.description")}{" "}
|
{t("terms:contact.description")}{" "}
|
||||||
<LinkTag href="mailto:sonnyasdev@gmail.com" target="_blank">
|
<LinkTag href="mailto:sonnyasdev@gmail.com" target="_blank">
|
||||||
sonnyasdev[at]gmail.com
|
sonnyasdev[at]gmail[dot]com
|
||||||
</LinkTag>
|
</LinkTag>
|
||||||
.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>{t("terms:footer.changes")}</p>
|
<p>{t("terms:footer.changes")}</p>
|
||||||
@@ -76,7 +75,7 @@ export default function Terms() {
|
|||||||
export async function getServerSideProps({ locale }) {
|
export async function getServerSideProps({ locale }) {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
...(await getServerSideTranslation(locale, ["terms"])),
|
...(await getServerSideTranslation(locale, ["terms"]))
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ body {
|
|||||||
width: 1280px;
|
width: 1280px;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
.privacy {
|
.legal main {
|
||||||
height: 100%;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.privacy main {
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.privacy h1 {
|
.legal h1 {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.privacy h2 {
|
.legal h2 {
|
||||||
margin-top: 1.5em;
|
margin-top: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.privacy h3 {
|
.legal h3 {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.privacy p {
|
.legal p {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user