Skip to content

Commit

Permalink
Added fitting render view disable option (minmatarfleet#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulmim authored Jun 3, 2024
1 parent 287d37a commit 76d6db9
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
4 changes: 4 additions & 0 deletions frontend/app/src/i18n/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,5 +764,9 @@ export const ui = {
'start_fleet_tracking': 'Start fleet tracking',
'start_fleet_tracking_description': 'Requieres fleet previously created in game',
'fleet_starting_soon': 'It seems you are creating a last minute fleet. Would you like to start tracking on creation?',
'rendering_issues_message': 'Having FPS issues with the ship renders?',
'disable_rendering': 'Disable ship rendering',
'dont_show_anymore': 'Don’t show this anymore',
'enable_rendering': 'Enable ship rendering',
},
} as const;
4 changes: 3 additions & 1 deletion frontend/app/src/pages/ships/fitting/[fitting_id].astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const normal_view = translatePath(`/ships/fitting/normal/${id}`)
---

<script define:vars={{ render_view, normal_view }}>
if (window.innerWidth > 1820)
const render_enabled = localStorage.getItem('_x_render_enabled')

if (window.innerWidth > 1820 && render_enabled === true)
window.location.href = render_view
else
window.location.href = normal_view
Expand Down
29 changes: 24 additions & 5 deletions frontend/app/src/pages/ships/fitting/normal/[fitting_id].astro
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ const page_title = fitting.name
---

<script define:vars={{ render_view }}>
if (window.innerWidth > 1820)
const render_enabled = localStorage.getItem('_x_render_enabled')

if (window.innerWidth > 1820 && render_enabled === true)
window.location.href = render_view
</script>

Expand All @@ -131,6 +133,10 @@ const page_title = fitting.name
scrollable: true,
overlay: true
}}
x-data={`{
render_enabled: $persist(true),
show_rendering_options: $persist(true),
}`}
>
<FlexInline slot="header" justification='space-between' class="[ w-full ]">
<FlexInline>
Expand All @@ -142,10 +148,23 @@ const page_title = fitting.name
</Flexblock>
</FlexInline>
</FlexInline>
<Button onclick="copyFitToClipboard('fit-clipboard', 'Fit copied (EFT Format): ')">
<ClipboardIcon slot="icon" />
{t('copy_to_clipboard')}
</Button>
<FlexInline>
<div
x-show="window.innerWidth > 1820"
style="display: none"
>
<Button
class="[ animate-fade-in ]"
x-on:click=`render_enabled = true; show_rendering_options = true; window.location.href = '${render_view}'`
>
{t('enable_rendering')}
</Button>
</div>
<Button onclick="copyFitToClipboard('fit-clipboard', 'Fit copied (EFT Format): ')">
<ClipboardIcon slot="icon" />
{t('copy_to_clipboard')}
</Button>
</FlexInline>
</FlexInline>

<Flexblock gap="var(--space-xl)">
Expand Down
29 changes: 28 additions & 1 deletion frontend/app/src/pages/ships/fitting/render/[fitting_id].astro
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ const page_title = fitting_parsed.name;
---

<script define:vars={{ normal_view }}>
if (window.innerWidth < 1820)
const render_enabled = localStorage.getItem('_x_render_enabled')

if (window.innerWidth < 1820 || render_enabled === false)
window.location.href = normal_view
</script>

Expand All @@ -97,6 +99,8 @@ const page_title = fitting_parsed.name;
fullscreen={true}
wide={true}
x-data={`{
render_enabled: $persist(true),
show_rendering_options: $persist(true),
rotation_x: -0.317,
rotation_y: 0.229,
ship_rotation: 0,
Expand Down Expand Up @@ -291,6 +295,29 @@ const page_title = fitting_parsed.name;
</Cargohold>
}
</Flexblock>

<Flexblock
class="[ animate-fade-in-up ]"
x-show="show_rendering_options"
style="display: none"
>
<small>{t('rendering_issues_message')}</small>
<FlexInline>
<Button
size='sm'
x-on:click=`render_enabled = false; navigate('${normal_view}')`
>
{t('disable_rendering')}
</Button>

<Button
size='sm'
x-on:click="show_rendering_options = false"
>
{t('dont_show_anymore')}
</Button>
</FlexInline>
</Flexblock>
</Flexblock>
</Wrapper>

Expand Down

0 comments on commit 76d6db9

Please sign in to comment.