Files
console/src/lib/components/creditCardBrandImage.svelte
T
Darshan b1df97a4c3 svelte5: cleanups, improvements (#1966)
* update: cleanups, improvements.

* fix: protocol usage.

* update: load failed invoice as non-blocking.

* address comments, make stuff faster!

* fix: missing type on org loads.

* fix: connect button shown on org. page.

* fix: error check.

* update: comment, just ocd things.

* update: flip `localStorage` check after `browser` check.

* update: comment.

* perf: parallelize fetch for faster loads [↓49%]

* update: compute things later.

* update: don't rely on dependency or reload if scope doesn't allow.

* update: simplify.

* update: do not load credits if the organization plan does not support it.

* update: just some cleaning.

* address comments for promise handling.

* address comments; remove: unused api calls!!!

* address comments;

* address comment.

* misc.

* cleaner endpoint creation.

* fix: required to optional.

* update: url to quick load.

* address comments.

* update: load payments on ui.

* update: load non-urgent calls on UI.

* fix: unnecessary runs of root layout.

* reduce: calls to countries, locale api.

* reduce: calls to countries, locale api in org settings.

* update: simplify api calls and data passing.

* address comments.

* remove: id from `UsageProjectInfo`.

* update: make api call only when needed.

* fix: text.

* fix: endpoint flag design <> verified by design.

* fix: `inline` inner stack so project name has enough space.

* fix: tests.

* update: improve orgs loading?

* update: misc.

* remove: todo.

* updates: more billing cleanups.

* misc.

* misc.

* fix: tests and a warning.

* address comment.

* fix: merge leftover issues.

* fix: tab selection on overview.

* fix: issues with user store on main project layout.

* remove: `selectedTab` store.

* fix: account menu regression.

* fix: reactive logic. use `svelte5` syntax.

* Remove trailing comma in invalidate array

* remove: unused method.

* updates: misc optimizations.

* fix: lint.

* update: changes after merge.

* update: modal size for credits and show loader.

* update: misc and PR freeze!

* update: use a default credit card icon if one isn't supported by the API.

* fix: project loading state as per updated org ID. LAST FIX.

* address comments.

---------

Co-authored-by: Torsten Dittmann <torsten.dittmann@googlemail.com>
2025-06-20 15:17:23 +02:00

23 lines
776 B
Svelte

<script lang="ts">
import { isValueOfStringEnum } from '$lib/helpers/types';
import { sdk } from '$lib/stores/sdk';
import { CreditCard } from '@appwrite.io/console';
import { Icon } from '@appwrite.io/pink-svelte';
import { IconCreditCard } from '@appwrite.io/pink-icons-svelte';
export let brand: string;
export let width = 23;
export let height = 16;
$: ccImage = isValueOfStringEnum(CreditCard, brand)
? sdk.forConsole.avatars.getCreditCard(brand, width, height)
: '';
</script>
{#if ccImage}
<img alt={brand} src={ccImage} {width} {height} style:border-radius="2.5px" />
{:else}
<!-- fallback: unionpay image not in Avatars API -->
<Icon icon={IconCreditCard} color="--fgcolor-neutral-tertiary" />
{/if}