Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form responsive improvements #2465

Merged
merged 7 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
{translate('schedules.recurring-dates-heading')}
</h3>
<p>{translate('schedules.recurring-dates-description')}</p>
<div class="flex w-full flex-col gap-4">
<DayOfMonthPicker bind:daysOfMonth />
<MonthPicker bind:months />
</div>
<DayOfMonthPicker bind:daysOfMonth />
<MonthPicker bind:months />
</div>
<SchedulesTimeView bind:hour bind:minute />
179 changes: 90 additions & 89 deletions src/lib/components/schedule/schedule-form-view.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import SchedulesCalendarView from '$lib/components/schedule/schedules-calendar-view.svelte';
import Alert from '$lib/holocene/alert.svelte';
import Button from '$lib/holocene/button.svelte';
import Card from '$lib/holocene/card.svelte';
import Input from '$lib/holocene/input/input.svelte';
import Link from '$lib/holocene/link.svelte';
import Loading from '$lib/holocene/loading.svelte';
Expand Down Expand Up @@ -165,99 +166,99 @@
onDestroy(() => ($error = ''));
</script>

<div class="pb-10">
<div class="flex flex-col gap-4 pb-10">
{#if $loading}
<Loading title={loadingText} />
{:else}
<header class="mb-12 flex flex-col gap-4">
<Link href={backHref} icon="chevron-left">
{backTitle}
</Link>
<h1>{title}</h1>
</header>
<form class="mb-4 flex w-full flex-col gap-4 md:w-2/3 xl:w-1/2">
<div class="w-full">
<Input
id="name"
bind:value={name}
label={translate('schedules.name-label')}
error={errors['name']}
maxLength={232}
disabled={Boolean(scheduleId)}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<div class="w-full">
<Input
id="workflowType"
bind:value={workflowType}
label={translate('schedules.workflow-type-label')}
error={errors['workflowType']}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<div class="w-full">
<Input
id="workflowId"
bind:value={workflowId}
label={translate('schedules.workflow-id-label')}
error={errors['workflowId']}
on:input={onInput}
on:blur={onBlur}
required
<Link href={backHref} icon="chevron-left">
{backTitle}
</Link>
<h1>{title}</h1>
<Card class="w-full xl:w-3/4 2xl:w-1/2">
<form class="mb-4 flex w-full flex-col gap-4">
<div class="w-full">
laurakwhit marked this conversation as resolved.
Show resolved Hide resolved
<Input
id="name"
bind:value={name}
label={translate('schedules.name-label')}
error={errors['name']}
maxLength={232}
disabled={Boolean(scheduleId)}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<div class="w-full">
<Input
id="workflowType"
bind:value={workflowType}
label={translate('schedules.workflow-type-label')}
error={errors['workflowType']}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<div class="w-full">
<Input
id="workflowId"
bind:value={workflowId}
label={translate('schedules.workflow-id-label')}
error={errors['workflowId']}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<div class="w-full">
<Input
id="taskQueue"
bind:value={taskQueue}
label={translate('schedules.task-queue-label')}
error={errors['taskQueue']}
on:input={onInput}
on:blur={onBlur}
required
/>
</div>
<ScheduleInputPayload
bind:input
bind:editInput
bind:encoding
payloads={schedule?.action?.startWorkflow?.input}
showEditActions={Boolean(schedule)}
/>
</div>
<div class="w-full">
<Input
id="taskQueue"
bind:value={taskQueue}
label={translate('schedules.task-queue-label')}
error={errors['taskQueue']}
on:input={onInput}
on:blur={onBlur}
required
<AddSearchAttributes
bind:attributesToAdd={searchAttributesInput}
class="w-full"
/>
</div>
<ScheduleInputPayload
bind:input
bind:editInput
bind:encoding
payloads={schedule?.action?.startWorkflow?.input}
showEditActions={Boolean(schedule)}
/>
<AddSearchAttributes
bind:attributesToAdd={searchAttributesInput}
class="w-full"
/>
<SchedulesCalendarView
let:preset
{schedule}
bind:daysOfWeek
bind:daysOfMonth
bind:months
bind:days
bind:hour
bind:minute
bind:second
bind:phase
bind:cronString
>
<div class="mt-4 flex flex-row items-center gap-4 max-sm:flex-col">
<Button
disabled={isDisabled(preset) || !writeActionsAreAllowed()}
on:click={() => handleConfirm(preset, schedule)}
class="max-sm:w-full">{confirmText}</Button
>
<Button variant="ghost" href={backHref} class="max-sm:w-full"
>{translate('common.cancel')}</Button
>
</div>
</SchedulesCalendarView>
<Alert intent="error" title={$error} hidden={!$error} />
</form>
<SchedulesCalendarView
let:preset
{schedule}
bind:daysOfWeek
bind:daysOfMonth
bind:months
bind:days
bind:hour
bind:minute
bind:second
bind:phase
bind:cronString
>
<div class="mt-4 flex flex-row items-center gap-4 max-sm:flex-col">
<Button
disabled={isDisabled(preset) || !writeActionsAreAllowed()}
on:click={() => handleConfirm(preset, schedule)}
class="max-sm:w-full">{confirmText}</Button
>
<Button variant="ghost" href={backHref} class="max-sm:w-full"
>{translate('common.cancel')}</Button
>
</div>
</SchedulesCalendarView>
<Alert intent="error" title={$error} hidden={!$error} />
</form>
</Card>
{/if}
</div>
8 changes: 4 additions & 4 deletions src/lib/components/schedule/schedules-interval-view.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<p>
{translate('schedules.interval-view-description')}
</p>
<div class="flex flex-col items-center gap-2 lg:flex-row">
<div class="flex flex-col gap-2 md:flex-row md:items-center">
<Input
id="days"
class="w-28"
Expand All @@ -54,7 +54,7 @@
maxLength={3}
error={error(days)}
/>
<div class="hidden lg:block">:</div>
<div class="hidden md:block">:</div>
<Input
id="hour-interval"
class="w-24"
Expand All @@ -67,7 +67,7 @@
maxLength={2}
error={error(hour)}
/>
<div class="hidden lg:block">:</div>
<div class="hidden md:block">:</div>
<Input
id="minute-interval"
class="w-24"
Expand All @@ -80,7 +80,7 @@
maxLength={2}
error={error(minute)}
/>
<div class="hidden lg:block">:</div>
<div class="hidden md:block">:</div>
<Input
id="second"
class="w-24"
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/workflow/add-search-attributes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
};
</script>

<div class="flex flex-col gap-2 {className}">
<div class="flex flex-col gap-4 {className}">
{#each attributesToAdd as attribute}
<SearchAttributeInput {attributesToAdd} bind:attribute {onRemove} />
{/each}
<Button
variant="ghost"
leadingIcon="add"
class="max-sm:w-full"
on:click={addSearchAttribute}
disabled={!searchAttributes.length ||
attributesToAdd.length === searchAttributes.length ||
Expand Down
43 changes: 26 additions & 17 deletions src/lib/components/workflow/search-attribute-input/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,31 @@
};
</script>

<div class="flex items-end gap-2">
<div class="min-w-fit">
<Select
id="search-attribute"
label={translate('workflows.custom-search-attribute')}
class="w-full"
placeholder={translate('workflows.select-attribute')}
bind:value={attribute.label}
onChange={handleAttributeChange}
>
{#each $customSearchAttributeOptions as { value, label, type }}
<Option disabled={isDisabled(value)} {value} description={type}
>{label}</Option
>
{/each}
</Select>
<div
class="flex flex-col gap-2 border-b border-subtle pb-4 sm:flex-row sm:gap-4"
>
<div class="flex min-w-fit justify-between gap-2 sm:gap-4">
<div class="grow [&_button]:w-full">
<Select
id="search-attribute"
label={translate('workflows.custom-search-attribute')}
placeholder={translate('workflows.select-attribute')}
bind:value={attribute.label}
onChange={handleAttributeChange}
>
{#each $customSearchAttributeOptions as { value, label, type }}
<Option disabled={isDisabled(value)} {value} description={type}
>{label}</Option
>
{/each}
</Select>
</div>
<Button
variant="ghost"
leadingIcon="close"
class="mt-6 w-10 rounded-full sm:hidden"
on:click={() => onRemove(attribute.label)}
/>
</div>
{#if attribute.type === SEARCH_ATTRIBUTE_TYPE.BOOL}
<Select
Expand Down Expand Up @@ -102,7 +111,7 @@
<Button
variant="ghost"
leadingIcon="close"
class="mt-6 w-10 rounded-full"
class="mt-6 w-10 rounded-full max-sm:hidden"
on:click={() => onRemove(attribute.label)}
/>
</div>
31 changes: 15 additions & 16 deletions src/lib/holocene/day-of-month-picker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@
};
</script>

<div class="text-center">
<div
class="surface-primary grid gap-x-4 gap-y-4 rounded border border-subtle px-0 py-4 text-center md:gap-x-8 md:px-2 xl:gap-x-16 xl:px-4"
>
{#each daysInMonth as day}
{@const active = daysOfMonth.includes(day)}
<Button
variant="secondary"
class={active && 'bg-interactive-secondary-active'}
on:click={(e) => onClick(e, day)}
>
{day}
</Button>
{/each}
</div>
<div
class="surface-primary grid place-items-center gap-1 rounded border border-subtle px-0 py-4 text-center sm:gap-4 md:gap-x-8 md:px-2 xl:gap-x-16 xl:px-4"
>
{#each daysInMonth as day}
{@const active = daysOfMonth.includes(day)}
<Button
variant="secondary"
class="max-md:h-9 max-md:px-4 max-md:py-1.5 max-md:text-sm max-sm:h-8 max-sm:px-2 max-sm:py-1 max-sm:text-xs {active &&
'bg-interactive-secondary-active'}"
on:click={(e) => onClick(e, day)}
>
{day}
</Button>
{/each}
</div>

<style lang="postcss">
.grid {
grid-template-columns: repeat(7, minmax(45px, 1fr));
grid-template-columns: repeat(7, minmax(32px, 1fr));
}
</style>
2 changes: 1 addition & 1 deletion src/lib/holocene/day-of-week-picker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</script>

<div class="flex flex-col gap-4 text-center">
<div class="flex gap-2 text-center">
<div class="flex flex-wrap gap-2 text-center">
{#each genericWeekDays as { label, value }}
{@const active = daysOfWeek.includes(value)}
<Button
Expand Down
Loading
Loading