fix: stepper fixes (#1240)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined the activation steps display with improved conditional
rendering and enhanced interactive button styling.
- **New Features**
- Introduced a new welcome page featuring a dummy server switcher and
refreshed welcome modal.
- Expanded the activation interface with a new activation code section
for clearer navigation.
- **Chores**
  - Removed the welcome modal from the home page to simplify the layout.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Zack Spear <hi@zackspear.com>
This commit is contained in:
Eli Bosley
2025-03-18 16:21:40 -04:00
committed by GitHub
parent 3380929c04
commit 6c042cbe01
5 changed files with 50 additions and 36 deletions

View File

@@ -30,7 +30,7 @@ const description = computed<string>(() =>
const docsButtons = computed<BrandButtonProps[]>(() => {
return [
{
btnStyle: 'underline',
variant: 'underline',
external: true,
href: 'https://docs.unraid.net/unraid-os/faq/licensing-faq/',
iconRight: ArrowTopRightOnSquareIcon,
@@ -38,7 +38,7 @@ const docsButtons = computed<BrandButtonProps[]>(() => {
text: props.t('More about Licensing'),
},
{
btnStyle: 'underline',
variant: 'underline',
external: true,
href: 'https://docs.unraid.net/account/',
iconRight: ArrowTopRightOnSquareIcon,

View File

@@ -21,7 +21,7 @@ type StepState = 'inactive' | 'active' | 'completed';
withDefaults(
defineProps<{
activeStep: number;
activeStep?: number;
}>(),
{
activeStep: 1,
@@ -75,44 +75,43 @@ const steps: readonly Step[] = [
<template>
<Stepper :default-value="activeStep" class="text-foreground flex w-full items-start gap-2 text-16px">
<StepperItem
v-for="step in steps"
v-for="(step, index) in steps"
:key="step.step"
v-slot="{ state }: { state: StepState }"
class="relative flex w-full flex-col items-center justify-center"
class="relative flex w-full flex-col items-center justify-center data-[disabled]:opacity-100"
:step="step.step"
:disabled="true"
>
<StepperSeparator
v-if="step.step !== steps[steps.length - 1].step"
class="absolute left-[calc(50%+20px)] right-[calc(-50%+10px)] top-[1.5rem] &block h-0.5 shrink-0 rounded-full bg-muted group-data-[state=completed]:bg-primary"
/>
<StepperTrigger>
<div class="flex items-center justify-center">
<Button
:variant="state === 'completed' ? 'primary' : state === 'active' ? 'primary' : 'outline'"
size="md"
:class="`z-10 rounded-full ${
state !== 'inactive'
? 'ring-2 ring-offset-2 ring-offset-background *:cursor-default ' +
(state === 'completed' ? 'ring-success' : 'ring-primary')
: ''
}`"
:disabled="state === 'inactive'"
>
<component :is="step.icon[state]" class="size-4" />
</Button>
</div>
<StepperTrigger as-child>
<Button
:variant="state === 'completed' || state === 'active' ? 'primary' : 'outline'"
size="md"
:class="`z-10 rounded-full shrink-0 opacity-100 ${
state !== 'inactive'
? 'ring-2 ring-primary ring-offset-2 ring-offset-background *:cursor-default'
: ''
}`"
:disabled="state === 'inactive'"
>
<component :is="step.icon[state]" class="size-4" />
</Button>
<div class="mt-2 flex flex-col items-center text-center">
<StepperTitle
:class="[state === 'active' && 'text-primary']"
class="text-2xs font-semibold transition"
>
{{ step.title }}
</StepperTitle>
<StepperDescription class="text-2xs font-normal">
{{ step.description }}
</StepperDescription>
</div>
</StepperTrigger>
<div class="mt-2 flex flex-col items-center text-center">
<StepperTitle
:class="[state === 'active' && 'text-primary']"
class="text-2xs font-semibold transition"
>
{{ step.title }}
</StepperTitle>
<StepperDescription class="text-2xs font-normal">
{{ step.description }}
</StepperDescription>
</div>
<StepperSeparator v-if="index < steps.length - 1" class="w-[50px] bg-black h-[30px]" />
</StepperItem>
</Stepper>
</template>

View File

@@ -146,8 +146,6 @@ const bannerImage = watch(theme, () => {
<ModalsCe />
<hr class="border-black dark:border-white" />
<h3 class="text-lg font-semibold font-mono">WelcomeModalCe</h3>
<!-- <WelcomeModalCe :server="serverState ?? undefined" /> -->
Uncomment the WelcomeModalCe component to test it.
<hr class="border-black dark:border-white" />
<h3 class="text-lg font-semibold font-mono">Test Callback Builder</h3>
<div class="flex flex-col justify-end gap-8px">

View File

@@ -57,6 +57,9 @@ onBeforeMount(() => {
<hr class="border-black dark:border-white" />
<h3 class="text-lg font-semibold font-mono">SSOSignInButtonCe</h3>
<unraid-sso-button :ssoenabled="serverState.ssoEnabled" />
<hr class="border-black dark:border-white" />
<h3 class="text-lg font-semibold font-mono">ActivationCodeCe</h3>
<unraid-welcome-modal />
</unraid-i18n-host>
<Toaster rich-colors close-button />
</client-only>

14
web/pages/welcome.vue Normal file
View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
import { useDummyServerStore } from '~/_data/serverState';
import DummyServerSwitcher from '~/components/DummyServerSwitcher.vue';
const serverStore = useDummyServerStore();
const { serverState } = storeToRefs(serverStore);
</script>
<template>
<div class="flex flex-col gap-6 p-6">
<DummyServerSwitcher />
<WelcomeModalCe :server="serverState ?? undefined" />
</div>
</template>