diff --git a/frontend/app/src/components/blocks/SRPBadge.astro b/frontend/app/src/components/blocks/SRPBadge.astro new file mode 100644 index 00000000..b31a2816 --- /dev/null +++ b/frontend/app/src/components/blocks/SRPBadge.astro @@ -0,0 +1,51 @@ +--- +import { i18n } from '@helpers/i18n' +const { t, translatePath } = i18n(Astro.url) + +import type { SRPUI } from '@dtypes/layout_components' + +interface Props { + srp: SRPUI; +} + +const { + srp, +} = Astro.props + +import FlexInline from '@components/compositions/FlexInline.astro'; +import Flexblock from '@components/compositions/Flexblock.astro'; +import FixedFluid from '@components/compositions/FixedFluid.astro'; + +import CharacterPicture from '@components/blocks/CharacterPicture.astro'; +import ItemPicture from '@components/blocks/ItemPicture.astro'; +--- + + + + +

{srp.amount.toLocaleString()} {t('isk')}

+ + + + {srp.character_id !== srp.primary_character_id && + + {srp.primary_character_name} + } + + + + {srp.ship_name} + + +
+
\ No newline at end of file diff --git a/frontend/app/src/components/blocks/SRPItem.astro b/frontend/app/src/components/blocks/SRPItem.astro index 87731875..f8a2f8bd 100644 --- a/frontend/app/src/components/blocks/SRPItem.astro +++ b/frontend/app/src/components/blocks/SRPItem.astro @@ -20,46 +20,15 @@ import { query_string } from '@helpers/string'; const SRP_TABLE_PARTIAL_URL = `${translatePath('/partials/srp_table_component')}` import FlexInline from '@components/compositions/FlexInline.astro'; -import Flexblock from '@components/compositions/Flexblock.astro'; -import FixedFluid from '@components/compositions/FixedFluid.astro'; import Button from '@components/blocks/Button.astro'; -import CharacterPicture from '@components/blocks/CharacterPicture.astro'; import ClipboardButton from '@components/blocks/ClipboardButton.astro'; -import ItemPicture from '@components/blocks/ItemPicture.astro'; +import SRPBadge from '@components/blocks/SRPBadge.astro'; --- - - - -

{srp.amount.toLocaleString()} {t('isk')}

- - - - {srp.character_id !== srp.primary_character_id && - - {srp.primary_character_name} - } - - - - {srp.ship_name} - - -
-
+ {`${srp.primary_character_name} ${srp.amount}`} @@ -76,9 +45,7 @@ import ItemPicture from '@components/blocks/ItemPicture.astro'; show_confirm_dialog({ title: '${t('accept_srp_dialog_title')}', partial: '${translatePath('/partials/dialog_with_srp/')}?${query_string({ - character_id: JSON.stringify(srp.character_id), - primary_character_id: JSON.stringify(srp.primary_character_id), - amount: JSON.stringify(srp.amount), + srp: JSON.stringify(srp), type: 'accept', message: t('accept_srp_dialog_text'), })}', @@ -107,9 +74,7 @@ import ItemPicture from '@components/blocks/ItemPicture.astro'; show_confirm_dialog({ title: '${t('reject_srp_dialog_title')}', partial: '${translatePath('/partials/dialog_with_srp/')}?${query_string({ - character_id: JSON.stringify(srp.character_id), - primary_character_id: JSON.stringify(srp.primary_character_id), - amount: JSON.stringify(srp.amount), + srp: JSON.stringify(srp), type: 'reject', message: t('deny_srp_dialog_text'), })}', diff --git a/frontend/app/src/pages/partials/dialog_with_srp.astro b/frontend/app/src/pages/partials/dialog_with_srp.astro index f6e133b6..f929d09a 100644 --- a/frontend/app/src/pages/partials/dialog_with_srp.astro +++ b/frontend/app/src/pages/partials/dialog_with_srp.astro @@ -1,37 +1,18 @@ --- -import { i18n } from '@helpers/i18n' -const { t } = i18n(Astro.url) +import type { SRPUI } from '@dtypes/layout_components' import Flexblock from '@components/compositions/Flexblock.astro'; import FlexInline from '@components/compositions/FlexInline.astro'; -import CharacterPicture from '@components/blocks/CharacterPicture.astro'; -import PilotBadge from '@components/blocks/PilotBadge.astro'; +import SRPBadge from '@components/blocks/SRPBadge.astro'; -const character_id = parseInt(Astro.url.searchParams.get('character_id') as string) -const primary_character_id = parseInt(Astro.url.searchParams.get('primary_character_id') as string) const message = Astro.url.searchParams.get('message') -const amount = parseInt(Astro.url.searchParams.get('amount') as string ?? '0') +const srp = JSON.parse(Astro.url.searchParams.get('srp') as string) as SRPUI ---

- -

{amount.toLocaleString()} {t('isk')}

- - {character_id === primary_character_id ? - {t('is_main_character')} : - {t('main_character')} - - } - - + + +
\ No newline at end of file