-
Notifications
You must be signed in to change notification settings - Fork 18
Feature/site sync to restore eco #2753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sunilsabatp
wants to merge
12
commits into
main
Choose a base branch
from
feature/site-sync-to-restore-eco
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0185aca
feat(projects): add site synchronization with RestoreEco integration.
sunilsabatp 465b3dd
perf: memoize handleSyncSites using useCallback to prevent unnecessar…
sunilsabatp 78ab6c0
feat: add sync icon
sunilsabatp 1bd44dc
refactor: match file name with component name
sunilsabatp 5b78e78
fix:: correct webhook URL by adding static endpoint ID before project…
sunilsabatp dcf1158
refactor: rename isSyncing to isSyncingSites for clarity
sunilsabatp 1e0d614
refactor: rename site sync modal state for clarity
sunilsabatp 672715d
feat: add rich text Restor.eco and Privacy Policy links in sync modal…
sunilsabatp 06a247b
feat: use separate state for snackbar
sunilsabatp 9c79fb9
feat: add syncing state support with disabled button and dynamic text
sunilsabatp edf16d6
refactor: rename state and translation key.
sunilsabatp ce0d57e
style: enhance inline link button with padding, border, and hover eff…
mohitb35 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -105,6 +105,7 @@ | |
| "recurrency", | ||
| "regenerant", | ||
| "Regenerants", | ||
| "Restor", | ||
| "seagrass", | ||
| "Segoe", | ||
| "senatDerWirtschaft", | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
91 changes: 91 additions & 0 deletions
91
src/features/user/ManageProjects/components/microComponent/SitesSyncActions.tsx
This file contains hidden or 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,91 @@ | ||
| import type { SetState } from '../../../../common/types/common'; | ||
|
|
||
| import { Alert, Snackbar } from '@mui/material'; | ||
| import { useTranslations } from 'next-intl'; | ||
| import CustomModal from '../../../../common/Layout/CustomModal'; | ||
| import styles from '../../StepForm.module.scss'; | ||
| import AutorenewIcon from '@mui/icons-material/Autorenew'; | ||
|
|
||
| interface SitesSyncActionsProps { | ||
| isSyncingSites: boolean; | ||
| isSiteSyncSuccessful: boolean; | ||
| snackbarOpen: boolean; | ||
| setSnackbarOpen: SetState<boolean>; | ||
| isSiteSyncModalOpen: boolean; | ||
| setIsSiteSyncModalOpen: SetState<boolean>; | ||
| handleSyncSites: () => Promise<void>; | ||
| } | ||
|
|
||
| const SitesSyncActions = ({ | ||
| isSyncingSites, | ||
| isSiteSyncSuccessful, | ||
| isSiteSyncModalOpen, | ||
| setIsSiteSyncModalOpen, | ||
| snackbarOpen, | ||
| setSnackbarOpen, | ||
| handleSyncSites, | ||
| }: SitesSyncActionsProps) => { | ||
| const tSyncSites = useTranslations('ManageProjects.syncSites'); | ||
| return ( | ||
| <> | ||
| {!isSiteSyncSuccessful && ( | ||
| <button | ||
| className={styles.inlineLinkButton} | ||
| type="button" | ||
| onClick={() => setIsSiteSyncModalOpen(true)} | ||
| > | ||
| <AutorenewIcon /> | ||
| {tSyncSites('syncSitesToRestorEco')} | ||
| </button> | ||
| )} | ||
| <Snackbar | ||
| open={snackbarOpen} | ||
| autoHideDuration={4000} | ||
| onClose={() => setSnackbarOpen(false)} | ||
| > | ||
| <Alert | ||
| elevation={6} | ||
| variant="filled" | ||
| severity="success" | ||
| onClose={() => setSnackbarOpen(false)} | ||
| > | ||
| {tSyncSites('success')} | ||
| </Alert> | ||
| </Snackbar> | ||
| <CustomModal | ||
| modalTitle={tSyncSites('modal.title')} | ||
| modalSubtitle={tSyncSites.rich('modal.subtitle', { | ||
| restorLink: (chunks) => ( | ||
| <a | ||
| href="https://restor.eco" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className={styles.restorLink} | ||
| > | ||
| {chunks} | ||
| </a> | ||
| ), | ||
| privacyPolicyLink: (chunks) => ( | ||
| <a | ||
| href="https://restor.eco/privacy-policy" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className={styles.restorLink} | ||
| > | ||
| {chunks} | ||
| </a> | ||
| ), | ||
| })} | ||
| continueButtonText={tSyncSites('send')} | ||
| cancelButtonText={tSyncSites('cancel')} | ||
| isOpen={isSiteSyncModalOpen} | ||
| isLoading={isSyncingSites} | ||
| loadingText={tSyncSites('syncing')} | ||
| handleCancel={() => setIsSiteSyncModalOpen(false)} | ||
| handleContinue={handleSyncSites} | ||
| /> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default SitesSyncActions; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.