-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(frontend): refactor user tour and cookies consent
- Loading branch information
1 parent
877ebf7
commit cce3642
Showing
13 changed files
with
129 additions
and
113 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
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,32 @@ | ||
import { isTourCompleted as isTourCompletedCheck } from '@lib/tour' | ||
|
||
export const COOKIE_CONSENT_LS_KEY = 'scissors-cookie-consent' | ||
|
||
export const acceptCookies = () => | ||
localStorage.setItem( | ||
COOKIE_CONSENT_LS_KEY, | ||
JSON.stringify({ | ||
accepted: true | ||
}) | ||
) | ||
|
||
export const isAccepted = () => !!localStorage.getItem(COOKIE_CONSENT_LS_KEY) | ||
|
||
export function isVisibleCheck(): boolean { | ||
/* | ||
* Check if already accepted. | ||
*/ | ||
if (isAccepted()) { | ||
return false | ||
} | ||
|
||
/* | ||
* Banner can be shown only once and only if user tour is completed. | ||
*/ | ||
const isTourCompleted = isTourCompletedCheck() | ||
if (!isTourCompleted) { | ||
return false | ||
} | ||
|
||
return isTourCompleted && !isAccepted() | ||
} |
16 changes: 15 additions & 1 deletion
16
apps/frontend/src/components/ImageUploader/ImageUploader.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
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
Oops, something went wrong.