forked from cvat-ai/cvat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
React UI: cookie policy drawer (cvat-ai#1511)
- Loading branch information
1 parent
483a3f2
commit 2e73ad7
Showing
8 changed files
with
112 additions
and
49 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
50 changes: 50 additions & 0 deletions
50
cvat-ui/src/components/login-page/cookie-policy-drawer.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
// Copyright (C) 2020 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
import React, {useState, useEffect} from 'react'; | ||
import Drawer from 'antd/lib/drawer'; | ||
import Paragraph from 'antd/lib/typography/Paragraph'; | ||
import Button from 'antd/lib/button/button'; | ||
|
||
import {isPublic} from 'utils/enviroment'; | ||
|
||
|
||
function CookieDrawer(): JSX.Element { | ||
const [drawerVisible, setDrawerVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
const cookiePolicyAccepted = localStorage.getItem('cookiePolicyAccepted'); | ||
if (cookiePolicyAccepted === null && isPublic()) { | ||
setDrawerVisible(true); | ||
} | ||
}, []) | ||
|
||
const onClose = () => { | ||
localStorage.setItem('cookiePolicyAccepted', 'true'); | ||
setDrawerVisible(false); | ||
} | ||
|
||
return ( | ||
<Drawer | ||
title='About Cookies on this site:' | ||
placement='bottom' | ||
closable={false} | ||
visible={drawerVisible} | ||
height={200} | ||
destroyOnClose | ||
> | ||
<Paragraph> | ||
This site uses cookies for functionality, analytics, and advertising purposes as described in our Cookie and Similar Technologies Notice. | ||
To see what cookies we serve and set your preferences, please visit our <a href='https://www.intel.com/cookies'>Cookie Consent Tool</a>. | ||
By continuing to use our website, you agree to our use of cookies. | ||
</Paragraph> | ||
<Button onClick={onClose} size='large' type='primary'> | ||
Accept | ||
</Button> | ||
</Drawer> | ||
); | ||
} | ||
|
||
export default CookieDrawer; |
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