Skip to content
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

feat(frontend): add info box in activity page #3548

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<script lang="ts">
import AllTransactionsList from '$lib/components/transactions/AllTransactionsList.svelte';
import MessageBox from '$lib/components/ui/MessageBox.svelte';
import PageTitle from '$lib/components/ui/PageTitle.svelte';
import { i18n } from '$lib/stores/i18n.store';
</script>

<PageTitle>{$i18n.activity.text.title}</PageTitle>
<div class="flex flex-col gap-5">
<PageTitle>{$i18n.activity.text.title}</PageTitle>

<AllTransactionsList />
<MessageBox level="plain">
{$i18n.activity.info.btc_transactions}
</MessageBox>

<AllTransactionsList />
</div>
5 changes: 3 additions & 2 deletions src/frontend/src/lib/components/ui/MessageBox.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<script lang="ts">
import IconInfo from '$lib/components/icons/lucide/IconInfo.svelte';

export let level: 'info' | 'light-warning' | 'error' = 'info';
export let level: 'plain' | 'info' | 'light-warning' | 'error' = 'info';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand "plain" in this context I have to say. 🤷‍♂️

Why not using "info"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on Figma, they have several levels for this message box, and they asked to be with white background (defined as plain) to have more contrast. The level info has a bluish background

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is "level === plain", what's a level "plain"?

But all good if it's use in Figma makes sense to use it here as well.

</script>

<div
class="mb-4 flex items-start gap-4 rounded-xl px-4 py-3 text-sm font-medium sm:text-base"
class:bg-primary={level === 'plain'}
class:bg-brand-subtle-alt={level === 'info'}
class:bg-warning-subtle={level === 'light-warning'}
class:bg-error-subtle-alt={level === 'error'}
>
<div
class="min-w-5 py-0 sm:py-0.5"
class:text-brand-primary={level === 'info'}
class:text-brand-primary={level === 'plain' || level === 'info'}
class:text-warning={level === 'light-warning'}
class:text-error={level === 'error'}
>
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@
"activity": {
"text": {
"title": "Recent Activity"
},
"info": {
"btc_transactions": "BTC transaction information is obtained from central third parties and should be independently verified."
}
}
}
1 change: 1 addition & 0 deletions src/frontend/src/lib/types/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ interface I18nLicense_agreement {

interface I18nActivity {
text: { title: string };
info: { btc_transactions: string };
}

interface I18n {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ describe('Activity', () => {
expect(title.textContent).toBe(en.activity.text.title);
});

it('renders the info box list', () => {
const { getByText } = render(AllTransactions);

expect(getByText(en.activity.info.btc_transactions)).toBeInTheDocument();
});

it('renders the transactions list', () => {
const { getByText } = render(AllTransactions);

Expand Down