-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d07b395
commit ce28aa5
Showing
7 changed files
with
86 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getGitInfo } from "@/utils/git-info"; | ||
import { pick } from "@/utils/i18n-utils"; | ||
import { NextIntlClientProvider } from "next-intl"; | ||
import { getLocale, getMessages } from "next-intl/server"; | ||
import React from "react"; | ||
import { DevVersionNotice } from "./dev-version-notice"; | ||
|
||
export async function DevVersionNoticeServer() { | ||
const gitInfo = await getGitInfo() | ||
if (gitInfo && gitInfo.isDev) { | ||
const locale = await getLocale() | ||
const messages = await getMessages() | ||
return ( | ||
<NextIntlClientProvider locale={locale} messages={pick(messages, 'component.dev_version_notice')}> | ||
<DevVersionNotice/> | ||
</NextIntlClientProvider> | ||
) | ||
} | ||
return <></> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client' | ||
|
||
import { NaLink } from "@/components/na-link"; | ||
import { siteConfig } from "@/site/config"; | ||
import { Notification } from "@mantine/core"; | ||
import { IconAlertCircle } from "@tabler/icons-react"; | ||
import { useTranslations } from "next-intl"; | ||
import { useState } from "react"; | ||
|
||
export function DevVersionNotice() { | ||
const t = useTranslations('component.dev_version_notice') | ||
const [isEnabled, setEnabled] = useState(true) | ||
return ( | ||
isEnabled && <Notification | ||
className="fixed top-[calc(var(--mw-navbar-height)+1rem)] right-[1rem] ml-[1rem] z-[100]" | ||
icon={<IconAlertCircle size={32}/>} | ||
color="yellow" | ||
withBorder={true} | ||
radius="md" | ||
title={t('title')} | ||
onClose={() => setEnabled(false)} | ||
> | ||
<p>{t('line1')}</p> | ||
<p>{t.rich('line2', { | ||
link: (chunks) => <NaLink href={siteConfig.links.website} external={false} hoverUnderline colored>{chunks}</NaLink> | ||
})}</p> | ||
</Notification> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters