Skip to content

Commit

Permalink
Merge pull request #3147 from glific/sync-hsm
Browse files Browse the repository at this point in the history
Moved sync button to top
  • Loading branch information
kurund authored Dec 10, 2024
2 parents f5c05d2 + 272f2ce commit 8995031
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
7 changes: 7 additions & 0 deletions src/containers/Template/List/Template.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,11 @@
display: flex;
align-items: center;
gap: 0.25rem;
}

.SecondaryButton {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0 0.5rem
}
55 changes: 30 additions & 25 deletions src/containers/Template/List/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ export const Template = ({
value: selectedTag,
}}
/>
{syncHSMButton}
</div>
);

Expand Down Expand Up @@ -397,43 +396,49 @@ export const Template = ({

if (isHSM) {
secondaryButton = (
<div className={styles.ImportButton}>
<a href={BULK_APPLY_SAMPLE_LINK} target="_blank" rel="noreferrer" className={styles.HelperText}>
View Sample
</a>
<div className={styles.SecondaryButton}>
{syncHSMButton}
<div className={styles.ImportButton}>
<a href={BULK_APPLY_SAMPLE_LINK} target="_blank" rel="noreferrer" className={styles.HelperText}>
View Sample
</a>
<ImportButton
title={t('Bulk apply')}
onImport={() => setImporting(true)}
afterImport={(result: string, media: any) => {
const extension = getFileExtension(media.name);
if (extension !== 'csv') {
setNotification('Please upload a valid CSV file', 'warning');
setImporting(false);
} else {
bulkApplyTemplates({ variables: { data: result } });
}
}}
/>
</div>
</div>
);
}

if (provider === GUPSHUP_ENTERPRISE_SHORTCODE) {
secondaryButton = (
<div className={styles.SecondaryButton}>
{syncHSMButton}
<ImportButton
title={t('Bulk apply')}
title={t('Import templates')}
onImport={() => setImporting(true)}
afterImport={(result: string, media: any) => {
const extension = getFileExtension(media.name);
if (extension !== 'csv') {
setNotification('Please upload a valid CSV file', 'warning');
setImporting(false);
} else {
bulkApplyTemplates({ variables: { data: result } });
importTemplatesMutation({ variables: { data: result } });
}
}}
/>
</div>
);
}

if (provider === GUPSHUP_ENTERPRISE_SHORTCODE) {
secondaryButton = (
<ImportButton
title={t('Import templates')}
onImport={() => setImporting(true)}
afterImport={(result: string, media: any) => {
const extension = getFileExtension(media.name);
if (extension !== 'csv') {
setNotification('Please upload a valid CSV file', 'warning');
setImporting(false);
} else {
importTemplatesMutation({ variables: { data: result } });
}
}}
/>
);
button.show = false;
}

Expand Down

0 comments on commit 8995031

Please sign in to comment.