Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
363f1e5
feat(intl): Add auto-publish setting descriptions.
judah-sotomayor Sep 26, 2025
e7d2643
feat(projects): Generalize PublicPrivateToggle.
judah-sotomayor Sep 26, 2025
1ad6e4e
fix(projects): Use name in settings toggles.
judah-sotomayor Sep 26, 2025
81a4443
feat(projects): Add ToggleForm component.
judah-sotomayor Sep 26, 2025
3091729
fix: Replace PublicPrivateToggle with Toggle.
judah-sotomayor Sep 26, 2025
f364bb3
feat(intl): Add notifs for auto toggles.
judah-sotomayor Sep 26, 2025
d931921
feat(server): Add routes for auto toggles.
judah-sotomayor Sep 26, 2025
784c517
feat(projects): Add toggles for auto rebuild/publish.
judah-sotomayor Sep 26, 2025
0359e0c
fix(server): Correct name of field in toggleRebuild.
judah-sotomayor Sep 26, 2025
2dc2c6b
fix(Toggle): Restore className property.
judah-sotomayor Oct 2, 2025
7d3a635
fix: Correct use of Toggle with on/off icons.
judah-sotomayor Oct 2, 2025
7050257
fix: Pass canEdit through ToggleForm.
judah-sotomayor Oct 2, 2025
1a7ff7c
fix(ToggleForm): Do not use ActionData.
judah-sotomayor Oct 2, 2025
e51d770
fix(Toggle): Replace onchange with inputAttr again.
judah-sotomayor Oct 2, 2025
ef08326
fix: Add auto build/publish settings to project sse.
judah-sotomayor Oct 2, 2025
d5eddad
Format code with eslint.
judah-sotomayor Oct 2, 2025
711391a
fix: Allow className to actually do something.
judah-sotomayor Oct 2, 2025
912a8fd
Add new authentication to auto-rebuild/publish toggles.
judah-sotomayor Oct 21, 2025
4c53d98
feat: Dim toggles when they are disabled.
judah-sotomayor Oct 23, 2025
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
50 changes: 0 additions & 50 deletions src/lib/components/settings/PublicPrivateToggle.svelte

This file was deleted.

49 changes: 49 additions & 0 deletions src/lib/components/settings/Toggle.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
import IconContainer from '../IconContainer.svelte';

Check warning on line 3 in src/lib/components/settings/Toggle.svelte

View workflow job for this annotation

GitHub Actions / typecheck-lint

'IconContainer' is defined but never used
import Icon from '@iconify/svelte';

Check warning on line 4 in src/lib/components/settings/Toggle.svelte

View workflow job for this annotation

GitHub Actions / typecheck-lint

`@iconify/svelte` import should occur before type import of `svelte/elements`
import InputWithMessage from './InputWithMessage.svelte';
import type { ValueKey } from '$lib/locales.svelte';

interface Props {
title?: ValueKey;
message?: ValueKey;
name?: string;
checked: boolean;
canEdit?: boolean;
onIcon?: string;
offIcon?: string;
className?: string;
inputAttr?: HTMLInputAttributes;
}

let {
title,
message,
name,
checked = $bindable(),
canEdit = true,
onIcon = '',
offIcon = '',
className,
inputAttr
}: Props = $props();
</script>

<InputWithMessage {title} {message} className="{className} {canEdit ? '' : 'cursor-not-allowed'} ">
<label
class="toggle {checked ? 'border-accent' : ''} text-base-content
{canEdit ? '' : 'cursor-not-allowed opacity-50 pointer-events-none'}"
>
<input
{name}
type="checkbox"
disabled={!canEdit}
bind:checked
{...inputAttr}
class="checked:bg-accent checked:border-accent rounded-full"
/>
<Icon icon={onIcon} width={20} height={20} />
<Icon icon={offIcon} width={20} height={20} color="white" />
</label>
</InputWithMessage>
80 changes: 80 additions & 0 deletions src/lib/components/settings/ToggleForm.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!--
@component
An abstraction over Toggle which makes it easier to submit simple POSTs using a toggle.
-->
<script lang="ts">
import { enhance } from '$app/forms';
import Toggle from '$lib/components/settings/Toggle.svelte';
import type { ValueKey } from '$lib/locales.svelte';
import { m } from '$lib/paraglide/messages';
import { toast } from '$lib/utils';
type Method = 'POST' | 'GET';

interface Props {
name: string;
method: Method;
action: string;
formVar: boolean;
onmsg: string;
offmsg: string;
onIcon?: string;
offIcon?: string;
title: ValueKey;
message: ValueKey;
canEdit?: boolean;
}

let {
name,
method,
action,
formVar,
onmsg,
offmsg,
title,
message,
onIcon,
offIcon,
canEdit
}: Props = $props();

let form: HTMLFormElement;
</script>

<form
bind:this={form}
{method}
{action}
use:enhance={() =>
({ update, result }) => {
if (result.type === 'success') {
const res = result.data as { ok: boolean };
if (res?.ok) {
if (formVar) {
toast('success', onmsg);
} else {
toast('success', offmsg);
}
} else {
toast('error', m.errors_generic({ errorMessage: '' }));
formVar = !formVar;
}
}
update({ reset: false });
}}
>
<Toggle
{title}
{message}
{name}
bind:checked={formVar}
inputAttr={{
onchange: () => {
form.requestSubmit();
}
}}
{onIcon}
{offIcon}
{canEdit}
/>
</form>
55 changes: 19 additions & 36 deletions src/lib/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
"localePicker_placeholder": "Search by Language...",
"localePicker_region": [
{
"declarations": [
"input count",
"local countPlural = count: plural"
],
"selectors": [
"countPlural"
],
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Region",
"countPlural=other": "Regions"
Expand All @@ -37,13 +32,8 @@
],
"localePicker_name": [
{
"declarations": [
"input count",
"local countPlural = count: plural"
],
"selectors": [
"countPlural"
],
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Name",
"countPlural=other": "Names"
Expand All @@ -52,13 +42,8 @@
],
"localePicker_tag": [
{
"declarations": [
"input count",
"local countPlural = count: plural"
],
"selectors": [
"countPlural"
],
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Tag",
"countPlural=other": "Tags"
Expand All @@ -67,13 +52,8 @@
],
"localePicker_variant": [
{
"declarations": [
"input count",
"local countPlural = count: plural"
],
"selectors": [
"countPlural"
],
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Variant",
"countPlural=other": "Variants"
Expand Down Expand Up @@ -266,12 +246,8 @@
"products_unpublished": "Unpublished",
"products_numArtifacts": [
{
"declarations": [
"local countPlural = amount: plural"
],
"selectors": [
"countPlural"
],
"declarations": ["local countPlural = amount: plural"],
"selectors": ["countPlural"],
"match": {
"amount=0": "No Product Files",
"countPlural=one": "{amount} Product File",
Expand Down Expand Up @@ -390,8 +366,12 @@
"project_details_language": "Language",
"project_details_type": "Project Type",
"project_settings_title": "Settings",
"project_autoRebuild_title": "Automatic Rebuilds",
"project_autoPublish_title": "Auto Publish on Rebuild",
"project_autoPublish_description": "When the rebuild workflow is run, skip verification and publish the app. Send a notification to owner and reviewers that the app was published without review.",
"project_autoRebuild_title": "Automatic Rebuild",
"project_autoRebuild_description": "When automatic rebuilds are on, Scriptoria will automatically rebuild your products when the input source is updated",
"project_autoRebuild_on_update_title": "Rebuild on Software Update",
"project_autoRebuild_on_update_description": "When the App Builder software used by Scriptoria is updated, rebuild the products of the project that have completed the initial workflow and are not currently being rebuilt.",
"project_orgDownloads_title": "Allow Other Organizations to download",
"project_orgDownloads_description": "When this setting is on, any Scriptoria User that is able to view your project in the Directory will be able to download the Product Files (the outputs of the products).",
"project_visibility_title": "Public Visibility",
Expand Down Expand Up @@ -419,6 +399,9 @@
"project_acts_downloads_on": "Allow project download is ON",
"project_acts_downloads_off": "Allow project download is OFF",
"project_acts_downloads_error": "Error: We could not change Allow Download status",
"project_acts_autoPublish_on": "Auto Publish is ON",
"project_acts_autoPublish_off": "Auto Publish is OFF",
"project_acts_autoPublish_error": "Error: We could not change Auto Publish status",
"project_acts_isPublic_on": "Project visibility is set to Public",
"project_acts_isPublic_off": "Project visibility is set to Private",
"project_acts_isPublic_error": "Error: We could not change Project visibility",
Expand Down Expand Up @@ -573,4 +556,4 @@
"system_publishFailed": "Publish failed",
"system_unavailable": "Scriptoria is currently unable to process background tasks",
"downloads_title": "Downloads"
}
}
Loading
Loading