-
Notifications
You must be signed in to change notification settings - Fork 61
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
Showing
20 changed files
with
291 additions
and
470 deletions.
There are no files selected for viewing
27 changes: 22 additions & 5 deletions
27
packages_rs/nextclade-web/src/components/Common/PreviewWarning.tsx
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 |
---|---|---|
@@ -1,29 +1,46 @@ | ||
import React, { useMemo } from 'react' | ||
import { Alert } from 'reactstrap' | ||
import { atom } from 'recoil' | ||
import { useRecoilToggle } from 'src/hooks/useToggle' | ||
import styled from 'styled-components' | ||
import { useTranslationSafe as useTranslation } from 'src/helpers/useTranslationSafe' | ||
import { UncontrolledAlert } from 'reactstrap' | ||
|
||
import { RELEASE_URL } from 'src/constants' | ||
import { LinkExternal } from 'src/components/Link/LinkExternal' | ||
|
||
const previewWarningDismissedAtom = atom({ | ||
key: 'previewWarningDismissedAtom', | ||
default: false, | ||
}) | ||
|
||
export function shouldRenderPreviewWarning(): boolean { | ||
return process.env.NODE_ENV !== 'development' && (process.env.BRANCH_NAME ?? '') !== 'release' | ||
} | ||
|
||
export function PreviewWarning() { | ||
const { t } = useTranslation() | ||
const { state: dismissed, enable: setDismissed } = useRecoilToggle(previewWarningDismissedAtom) | ||
|
||
const warningText = useMemo(() => t('This is a preview version. For official website please visit '), [t]) | ||
|
||
if (!shouldRenderPreviewWarning()) { | ||
if (!shouldRenderPreviewWarning() || dismissed) { | ||
return null | ||
} | ||
|
||
return ( | ||
<UncontrolledAlert color="warning" className="text-center m-0" fade={false}> | ||
<Warning color="warning" fade={false} isOpen toggle={setDismissed}> | ||
<span>{warningText}</span> | ||
<span> | ||
<LinkExternal href={RELEASE_URL}>{RELEASE_URL}</LinkExternal> | ||
</span> | ||
</UncontrolledAlert> | ||
</Warning> | ||
) | ||
} | ||
|
||
const Warning = styled(Alert)` | ||
font-size: 0.9rem; | ||
text-align: center; | ||
margin: 0; | ||
padding: 5px 3px; | ||
border-radius: 0; | ||
z-index: 1010; | ||
` |
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
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
31 changes: 0 additions & 31 deletions
31
packages_rs/nextclade-web/src/components/Results/ButtonBack.tsx
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.