Skip to content

Commit

Permalink
fix(frontend): imporve alert styling and use notify for magic link al…
Browse files Browse the repository at this point in the history
…erts
  • Loading branch information
c0rydoras committed Nov 25, 2024
1 parent a54adbe commit 9dbc528
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
6 changes: 0 additions & 6 deletions frontend/app/components/alert.hbs

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/app/components/filter-sidebar/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<FaIcon @icon="sliders" @prefix="fas" />
{{#if @appliedCount}}
<span
class="filter-sidebar-toggle-icon-badge bg-success text-foreground-primary absolute right-2 top-2 rounded-[50%] px-1 py-0.5 font-mono text-xs shadow-sm duration-300"
class="filter-sidebar-toggle-icon-badge bg-success-light text-foreground-primary absolute right-2 top-2 rounded-[50%] px-1 py-0.5 font-mono text-xs shadow-sm duration-300"
>{{@appliedCount}}</span>
{{/if}}
</span>
Expand Down
9 changes: 5 additions & 4 deletions frontend/app/components/magic-link-modal/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class MagicLinkModal extends Component {
@tracked errorMsg;

@service router;
@service notify;

@action
onSetTask(task) {
Expand All @@ -37,11 +38,11 @@ export default class MagicLinkModal extends Component {
copyToClipboard() {
try {
navigator.clipboard.writeText(this.magicLinkString);
this.statusMsg =
"Magic link copied to clipboard. You can now send it to a friendly coworker!";
this.notify.success(
"Magic link copied to clipboard.\nYou can now send it to a friendly coworker!",
);
} catch {
/* istanbul ignore next */
this.errorMsg = "Could not copy to clipboard";
this.notify.error("Could not copy to clipboard");
}
}
}
10 changes: 0 additions & 10 deletions frontend/app/components/magic-link-modal/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@
aria-label="magic link string"
data-test-magic-link-string
/>
{{#if this.statusMsg}}
<Alert class="text-success">
{{this.statusMsg}}
</Alert>
{{/if}}
{{#if this.errorMsg}}
<Alert class="text-danger">
{{this.errorMsg}}
</Alert>
{{/if}}
</modal.body>
<modal.footer class="flex justify-end">
<button
Expand Down
10 changes: 7 additions & 3 deletions frontend/app/styles/components/alert.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.ember-notify.alert {
@apply rounded;
}

.ember-notify.alert-danger {
@apply bg-danger text-foreground-primary border-danger/80;
@apply bg-danger-light text-foreground-primary border-danger/80;
}

.ember-notify.alert-info {
@apply bg-primary text-foreground-primary border-primary/80;
@apply bg-primary-light text-foreground-primary border-primary/80;
}

.ember-notify.alert-success {
@apply bg-success text-foreground-primary border-success/80;
@apply bg-success-light text-foreground-primary border-success/80;
}
3 changes: 2 additions & 1 deletion frontend/config/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ module.exports = {
},
plugins: [forms()],
safelist: [
{ pattern: /noUi-/ },
{ pattern: /alert-/ },
{ pattern: /ember-/ },
{ pattern: /noUi-/ },
{ pattern: /shepherd-/ },
"invalid-feedback",
],
Expand Down
2 changes: 1 addition & 1 deletion frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9dbc528

Please sign in to comment.