Skip to content

Commit

Permalink
Updated dialog with SRP (minmatarfleet#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulmim authored Dec 1, 2024
1 parent 93b7964 commit 90883b4
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 64 deletions.
51 changes: 51 additions & 0 deletions frontend/app/src/components/blocks/SRPBadge.astro
Original file line number Diff line number Diff line change
@@ -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';
---

<FixedFluid
width='64px'
gap='var(--space-s)'
class="[ basis-[250px] !items-center ]"
>
<CharacterPicture
character_id={srp.character_id}
character_name={srp.character_name}
size={64}
icon_quality={64}
tooltip={srp.character_name}
/>
<Flexblock gap='var(--space-3xs)'>
<h3>{srp.amount.toLocaleString()} {t('isk')}</h3>

<Flexblock gap='0'>
<FlexInline gap='var(--space-3xs)' class="[ grow ]">
{srp.character_id !== srp.primary_character_id &&
<CharacterPicture character_id={srp.primary_character_id} character_name={srp.primary_character_name} size={16} icon_quality={32} />
<small>{srp.primary_character_name}</small>
}
</FlexInline>
<FlexInline gap='var(--space-3xs)' class="[ grow ]">
<ItemPicture item_id={srp.ship_type_id} item_name={srp.ship_name} size={16} icon_quality={32} />
<small>{srp.ship_name}</small>
</FlexInline>
</Flexblock>
</Flexblock>
</FixedFluid>
43 changes: 4 additions & 39 deletions frontend/app/src/components/blocks/SRPItem.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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';
---

<FlexInline justification='space-between' class="[ srp-item ][ w-full ]">
<FlexInline class="[ grow ]">
<FixedFluid
width='64px'
gap='var(--space-s)'
class="[ basis-[250px] !items-center ]"
>
<CharacterPicture
character_id={srp.character_id}
character_name={srp.character_name}
size={64}
icon_quality={64}
tooltip={srp.character_name}
/>
<Flexblock gap='var(--space-3xs)'>
<h3>{srp.amount.toLocaleString()} {t('isk')}</h3>

<Flexblock gap='0'>
<FlexInline gap='var(--space-3xs)' class="[ grow ]">
{srp.character_id !== srp.primary_character_id &&
<CharacterPicture character_id={srp.primary_character_id} character_name={srp.primary_character_name} size={16} icon_quality={32} />
<small>{srp.primary_character_name}</small>
}
</FlexInline>
<FlexInline gap='var(--space-3xs)' class="[ grow ]">
<ItemPicture item_id={srp.ship_type_id} item_name={srp.ship_name} size={16} icon_quality={32} />
<small>{srp.ship_name}</small>
</FlexInline>
</Flexblock>
</Flexblock>
</FixedFluid>
<SRPBadge srp={srp} />
<FlexInline>
<ClipboardButton id={`srp-name-${srp.id}`}>{`${srp.primary_character_name} ${srp.amount}`}</ClipboardButton>
</FlexInline>
Expand All @@ -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'),
})}',
Expand Down Expand Up @@ -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'),
})}',
Expand Down
31 changes: 6 additions & 25 deletions frontend/app/src/pages/partials/dialog_with_srp.astro
Original file line number Diff line number Diff line change
@@ -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
---

<Flexblock>
<p set:html={message} />
<PilotBadge
character_id={character_id}
character_name=""
class="[ grow ]"
>
<h3 slot="title">{amount.toLocaleString()} {t('isk')}</h3>
<FlexInline gap='var(--space-3xs)'>
{character_id === primary_character_id ?
<small>{t('is_main_character')}</small> :
<small>{t('main_character')}</small>
<CharacterPicture
character_id={primary_character_id}
size={16}
icon_quality={32}
/>
}
</FlexInline>
</PilotBadge>
<FlexInline>
<SRPBadge srp={srp} />
</FlexInline>
</Flexblock>

0 comments on commit 90883b4

Please sign in to comment.