Skip to content

Conversation

@judah-sotomayor
Copy link
Contributor

@judah-sotomayor judah-sotomayor commented Sep 26, 2025

Add the toggles necessary for automatic builds.
Addresses #1235

Summary by CodeRabbit

  • New Features

    • Added project settings for Auto Publish on Rebuild and Rebuild on Software Update with server actions to toggle them.
    • Introduced a customizable Toggle component (optional on/off icons, editable/disabled states) and a ToggleForm that auto-submits on change.
    • Expanded translations (en-US, es-419, fr-FR) for new settings and status messages.
  • Refactor

    • Replaced legacy public/private toggle with the new Toggle across app settings and consolidated settings to use ToggleForm.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

Walkthrough

Adds a reusable Toggle and ToggleForm, replaces PublicPrivateToggle with Toggle across routes, adds server actions and project fields for AutoPublishOnRebuild and RebuildOnSoftwareUpdate, updates Settings to use ToggleForm, and adds localization keys for auto-publish/rebuild.

Changes

Cohort / File(s) Summary
New Toggle components
src/lib/components/settings/Toggle.svelte, src/lib/components/settings/ToggleForm.svelte
Introduces Toggle.svelte (props: name, checked, canEdit, onIcon, offIcon, className, inputAttr) and ToggleForm.svelte which wraps Toggle, binds form state, and auto-submits via SvelteKit enhance with toast success/error handling.
Removed component
src/lib/components/settings/PublicPrivateToggle.svelte
Removes the legacy PublicPrivateToggle component; its usages converted to the new Toggle.
Settings UI refactor (project)
src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte, src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte
Replaces per-field forms and PublicPrivateToggle with ToggleForm instances for visibility, downloads, auto-rebuild, and auto-publish; updates project projection to include AutoPublishOnRebuild and RebuildOnSoftwareUpdate; simplifies Settings invocation to { project, canEdit }.
Route usages updated to Toggle
src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte, src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte, src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte
Replaces PublicPrivateToggle imports/usages with Toggle; prop rename formNamename; passes onIcon/offIcon and inputAttr where applicable.
Server actions added
src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts
Adds toggleAutoPublishOnRebuild and toggleRebuildOnSoftwareUpdate actions that validate a boolean form field, check permissions, update corresponding Project fields, and return { form, ok: true } or 400 on invalid form.
Project details projection
src/lib/projects/sse.ts
Extends getProjectDetails select projection to include AutoPublishOnRebuild and RebuildOnSoftwareUpdate.
Locales updated
src/lib/locales/en-US.json, src/lib/locales/es-419.json, src/lib/locales/fr-FR.json
Adds keys for auto-publish and on-update auto-rebuild titles/descriptions and action messages; normalizes some array formatting and updates project_autoRebuild_title wording.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as ToggleForm (client)
  participant S as +page.server.ts (action)
  participant DB as Project Store

  User->>UI: click toggle
  UI->>UI: update bound formVar
  UI->>UI: call form.submit() (enhance)
  UI->>S: POST { <field>: boolean }
  S->>DB: update Project.<field>
  DB-->>S: success / failure
  S-->>UI: { ok: true/false, form }
  alt ok == true
    UI->>User: show on/off toast
  else
    UI->>UI: revert formVar
    UI->>User: show error toast
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • chrisvire
  • 7dev7urandom

Poem

A rabbit flips a toggle with a grin,
Forms hop, submit, and toast begins.
Auto-publish wakes, rebuilds softly hum,
Servers nod, the workflows run and run.
Hop! Settings set — the rabbit's work is done. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Feature/automatic builds project options" directly and clearly summarizes the primary objective of this changeset. The PR description explicitly states "Add the toggles necessary for automatic builds. Addresses #1235", and the changes substantiate this by introducing two new project settings: automatic publishing on rebuild and rebuilding on software updates. While the PR also includes supporting refactoring work (a new generic Toggle component, removal of PublicPrivateToggle, and a new ToggleForm wrapper), these are implementation details that enable the main feature. The title is specific and avoids vague terminology, making it clear to reviewers scanning history what the primary intent is.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@FyreByrd FyreByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks good; there are just a few things that were lost when refactoring to Toggle.svelte.

  1. Any time that we used PublicPrivateToggle should still have the lock icons, unless @chrisvire or @7dev7urandom say otherwise. Similarly, there are some other places (I haven't actually looked) where you could probably use the new Toggle or ToggleForm.
  2. We recently made some changes (see #1275 ) that disable the ability to modify the settings on a project if a user is allowed to view, but not edit, the project. Those changes have disappeared entirely. (VS Code shows that the canEdit variable in /projects/[id]/forms/Settings.svelte as being completely unused).
  3. You will want to run npm run check and npm run lint. Many of the issues that I have pointed out in the comments are in fact found by running those commands.

@judah-sotomayor judah-sotomayor force-pushed the feature/automatic-builds-project-options branch from e782bf5 to a206027 Compare October 2, 2025 17:07
@judah-sotomayor
Copy link
Contributor Author

Rebased onto main.

@judah-sotomayor judah-sotomayor marked this pull request as ready for review October 2, 2025 17:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
src/lib/components/settings/ToggleForm.svelte (1)

50-61: Past review concern appears resolved.

The cast to { ok: boolean } on line 51 addresses the previous feedback about ActionData. The type is now inline as suggested.

However, verify the revert logic on line 60: when !ok, formVar is toggled back. Since formVar has already been updated by the Toggle's onchange (line 72-74), the revert correctly undoes the optimistic update. The toast messages on lines 54 and 56 use the current (new) state of formVar to decide which message to show, which aligns with the expected behavior.

src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1)

18-18: Verify that canEdit disables the toggle inputs.

The past review comment indicates that canEdit should disable form inputs. In the current implementation, canEdit is passed to each ToggleForm, which forwards it to the underlying Toggle component.

Ensure that the Toggle component properly disables the input when canEdit is false. This behavior is critical to prevent unauthorized modifications.

Run the following script to verify the Toggle component's handling of canEdit:

#!/bin/bash
# Check if Toggle component properly handles canEdit/disabled state

ast-grep --pattern $'export let canEdit$$$'

ast-grep --pattern $'disabled={$_}'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2b3114 and a206027.

📒 Files selected for processing (12)
  • src/lib/components/settings/Toggle.svelte (2 hunks)
  • src/lib/components/settings/ToggleForm.svelte (1 hunks)
  • src/lib/locales/en-US.json (8 hunks)
  • src/lib/locales/es-419.json (8 hunks)
  • src/lib/locales/fr-FR.json (2 hunks)
  • src/lib/projects/sse.ts (1 hunks)
  • src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte (2 hunks)
  • src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1 hunks)
  • src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (1)
src/lib/server/database/index.ts (1)
  • DatabaseWrites (68-71)
🪛 GitHub Actions: Scriptoria v2 Test and Deploy
src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts

[error] 321-321: eslint: Missing call to requireAuthenticated() or similar security check. This must be of the form locals.security.require*() sveltekit-sec/require-security-check

🪛 GitHub Check: typecheck-lint
src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts

[failure] 337-337:
Missing call to requireAuthenticated() or similar security check. This must be of the form locals.security.require*()


[failure] 321-321:
Missing call to requireAuthenticated() or similar security check. This must be of the form locals.security.require*()

🔇 Additional comments (20)
src/lib/components/settings/ToggleForm.svelte (1)

66-80: LGTM!

The Toggle integration is clean: checked is bound to formVar, and the inputAttr.onchange handler triggers form submission. All necessary props are forwarded correctly.

src/lib/projects/sse.ts (1)

30-31: LGTM!

The addition of AutoPublishOnRebuild and RebuildOnSoftwareUpdate to the project select correctly exposes the new fields needed for the automatic builds feature.

src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1)

243-243: LGTM!

Simplifying the Settings component props by removing publicEndpoint and downloadEndpoint is a good encapsulation refactor. The endpoints are now managed internally within Settings.

src/lib/locales/fr-FR.json (2)

368-372: LGTM!

The French locale additions for auto-publish and auto-rebuild features are properly structured and align with the new toggle functionality.


397-399: LGTM!

The action message translations for auto-publish on/off/error states are consistent with the existing pattern for other toggle features.

src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte (1)

103-111: LGTM!

The migration from PublicPrivateToggle to Toggle with the updated props (name, onIcon, offIcon) is consistent with the broader refactoring effort across the codebase.

src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1)

33-82: LGTM!

The four ToggleForm usages follow a consistent pattern for handling project settings toggles. Each correctly binds to its state variable, specifies appropriate endpoints, and provides clear success/error messages.

The addition of lock icons (mdi:lock-open-variant, mdi:lock) for the visibility toggle enhances the UI clarity.

src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte (1)

36-47: LGTM!

The migration to the Toggle component with updated props (name, onIcon, offIcon) is consistent with the broader refactoring pattern across the application.

src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (1)

8-8: LGTM!

The import has been correctly updated to use the new Toggle component instead of PublicPrivateToggle.

src/lib/locales/es-419.json (3)

23-61: LGTM!

The reformatting of localePicker entries from multi-line to single-line arrays preserves semantic content while improving readability.


245-254: LGTM!

The reformatting of products_numArtifacts declarations and selectors is consistent with the localePicker changes.


368-373: LGTM!

The new translation keys for auto-publish and auto-rebuild features are well-defined and align with the PR objectives. The Spanish translations are appropriate.

Also applies to: 398-400

src/lib/locales/en-US.json (3)

23-61: LGTM!

The reformatting of localePicker entries is consistent with the changes in es-419.json and preserves semantic content.


245-254: LGTM!

The reformatting of products_numArtifacts is consistent with the corresponding changes in es-419.json.


368-373: LGTM!

The new translation keys for auto-publish and auto-rebuild features are well-defined and align with the PR objectives. The English translations are clear and appropriate.

Also applies to: 401-403

src/lib/components/settings/Toggle.svelte (5)

7-17: LGTM!

The Props interface has been correctly updated to reflect the new API:

  • formName renamed to name
  • New props canEdit, onIcon, offIcon, and className added

These changes support the component's enhanced flexibility for different use cases.


19-29: LGTM!

The destructuring correctly handles the new props with appropriate defaults:

  • canEdit = true (enables editing by default)
  • onIcon = '' and offIcon = '' (no icons by default)

32-32: LGTM!

The conditional cursor-not-allowed styling correctly addresses the past review comment, applying the disabled cursor only when canEdit is false while preserving any custom className passed in.


35-42: LGTM!

The input element has been correctly updated:

  • name binding replaces formName
  • disabled attribute correctly bound to !canEdit

This ensures the toggle is properly disabled when canEdit is false.


49-56: LGTM!

The icon rendering has been correctly updated to use dynamic IconContainer components with configurable onIcon and offIcon props, replacing the hardcoded icons. This provides the flexibility needed for different toggle use cases.

@FyreByrd FyreByrd linked an issue Oct 21, 2025 that may be closed by this pull request
@judah-sotomayor judah-sotomayor force-pushed the feature/automatic-builds-project-options branch from a206027 to 772c3d6 Compare October 23, 2025 14:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (1)

87-96: Remove the empty onchange handler.

The inputAttr prop contains an empty onchange handler on line 92 that serves no purpose and should be removed.

Apply this diff to remove the unnecessary handler:

         <Toggle
           title={{ key: 'project_public' }}
           message={{ key: 'project_visibilityDescription' }}
           className="py-2 md:max-w-xs"
           name="IsPublic"
-          inputAttr={{ onchange: () => {} }}
           bind:checked={$form.IsPublic}
           onIcon="mdi:lock-open-variant"
           offIcon="mdi:lock"
         />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a206027 and 772c3d6.

📒 Files selected for processing (12)
  • src/lib/components/settings/Toggle.svelte (2 hunks)
  • src/lib/components/settings/ToggleForm.svelte (1 hunks)
  • src/lib/locales/en-US.json (8 hunks)
  • src/lib/locales/es-419.json (8 hunks)
  • src/lib/locales/fr-FR.json (2 hunks)
  • src/lib/projects/sse.ts (1 hunks)
  • src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte (2 hunks)
  • src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1 hunks)
  • src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte
  • src/lib/locales/fr-FR.json
  • src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte
  • src/lib/components/settings/Toggle.svelte
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts
  • src/lib/locales/en-US.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-test
🔇 Additional comments (4)
src/lib/projects/sse.ts (1)

30-32: LGTM!

The additions of AutoPublishOnRebuild and RebuildOnSoftwareUpdate to the project data projection are consistent with the existing boolean fields pattern and align with the PR's objective to support automatic builds.

src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1)

242-242: LGTM!

The simplified Settings component usage improves encapsulation by moving endpoint management into the component itself, consistent with the new ToggleForm-based architecture.

src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1)

33-81: LGTM!

All four ToggleForm instances consistently pass the canEdit prop, which addresses the previous review concern about preserving the ability to disable form inputs based on edit permissions.

src/lib/components/settings/ToggleForm.svelte (1)

1-80: LGTM!

This component provides a clean abstraction for toggle-based form submissions with proper error handling, state rollback on failure, and auto-submit behavior. The inline type assertion on line 51 addresses the previous review feedback about the ActionData type.

Copy link
Contributor

@FyreByrd FyreByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick with the CSS styling. Everything else looks good to me.

Generalize the PublicPrivateToggle component into Toggle.
Use Toggle in the project settings page.
This will enable its use in settings.
Paper over the repetitive `form`s in settings using a new ToggleForm component.
Several PublicPrivateToggle uses sstill existed, replace them with just Toggle.
Add the internationalizations for auto publish/rebuild toggle notifications.
Add the routes for AutoPublishOnRebuild and RebuildOnSoftwareUpdate.
Remove the parameterization of endpoints, as Settings is not a good
abstraction already.
Add the new toggles and their endpoints.
Correct the field used by the server for the toggleRebuild path.
Restore the lock icon in locations where PublicPrivateToggle was
replaced with Toggle.
Replace ActionData with { ok: boolean } type.
The toggle component is now greatly simplified.
I replaced the custom toggle with daisyui's toggle-and-icon support.

I also enabled an opacity reduction when the toggle is not enabled.
@judah-sotomayor judah-sotomayor force-pushed the feature/automatic-builds-project-options branch from 772c3d6 to 4c53d98 Compare October 23, 2025 19:13
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/lib/locales/es-419.json (2)

370-370: Fix Spanish typo.

Line 370 contains "propietaro" which should be "propietario" (missing the second "i").

-  "project_autoPublish_description": "Cuando se ejecuta la compilación, omite la verificación y publica la aplicación. Notificar al propietaro y a los revisores que la aplicación se publicó sin revisión.",
+  "project_autoPublish_description": "Cuando se ejecuta la compilación, omite la verificación y publica la aplicación. Notificar al propietario y a los revisores que la aplicación se publicó sin revisión.",

399-399: Fix missing accent in Spanish verb.

Line 399 contains "esta" which should be "está" (present tense third-person singular of "estar" requires an accent mark).

-  "project_acts_autoPublish_on": "Publicaciones automáticas esta activada",
+  "project_acts_autoPublish_on": "Publicaciones automáticas está activada",
🧹 Nitpick comments (2)
src/lib/components/settings/Toggle.svelte (2)

2-5: Clean up imports and satisfy import-order lint.

Remove the unused IconContainer and place value imports before type-only imports to appease the linter.

-import type { HTMLInputAttributes } from 'svelte/elements';
-import IconContainer from '../IconContainer.svelte';
-import Icon from '@iconify/svelte';
-import InputWithMessage from './InputWithMessage.svelte';
-import type { ValueKey } from '$lib/locales.svelte';
+import Icon from '@iconify/svelte';
+import InputWithMessage from './InputWithMessage.svelte';
+import type { HTMLInputAttributes } from 'svelte/elements';
+import type { ValueKey } from '$lib/locales.svelte';

38-45: Avoid attribute collisions; let consumers override or merge classes.

With class set after the spread, inputAttr.class is currently ignored. Either move the spread after class (to allow overrides) or explicitly merge classes by extracting class from inputAttr.

Minimal change to allow overrides:

-      {...inputAttr}
-      class="checked:bg-accent checked:border-accent rounded-full"
+      class="toggle checked:bg-accent checked:border-accent rounded-full"
+      {...inputAttr}

Alternative (merge classes):

<script lang="ts">
  // ...
  let otherInputAttr: HTMLInputAttributes | undefined;
  let inputClass = '';
  $effect.pre(() => {
    const { class: cls, ...rest } = inputAttr ?? {};
    inputClass = cls ?? '';
    otherInputAttr = rest as HTMLInputAttributes;
  });
</script>

<input
  {name}
  type="checkbox"
  disabled={!canEdit}
  bind:checked
  class="toggle checked:bg-accent checked:border-accent rounded-full {inputClass}"
  {...otherInputAttr}
/>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 772c3d6 and 4c53d98.

📒 Files selected for processing (13)
  • src/lib/components/settings/PublicPrivateToggle.svelte (0 hunks)
  • src/lib/components/settings/Toggle.svelte (1 hunks)
  • src/lib/components/settings/ToggleForm.svelte (1 hunks)
  • src/lib/locales/en-US.json (8 hunks)
  • src/lib/locales/es-419.json (8 hunks)
  • src/lib/locales/fr-FR.json (2 hunks)
  • src/lib/projects/sse.ts (1 hunks)
  • src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte (2 hunks)
  • src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (2 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1 hunks)
  • src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (1 hunks)
  • src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte (2 hunks)
💤 Files with no reviewable changes (1)
  • src/lib/components/settings/PublicPrivateToggle.svelte
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/routes/(authenticated)/projects/new/[id=idNumber]/+page.svelte
  • src/lib/projects/sse.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (2)
src/lib/server/database/prisma.ts (1)
  • DatabaseReads (22-22)
src/lib/server/database/index.ts (1)
  • DatabaseWrites (68-71)
🪛 GitHub Check: typecheck-lint
src/lib/components/settings/Toggle.svelte

[warning] 4-4:
@iconify/svelte import should occur before type import of svelte/elements


[warning] 3-3:
'IconContainer' is defined but never used

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-test
🔇 Additional comments (15)
src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte (1)

242-242: LGTM: Settings API simplified.

The removal of publicEndpoint and downloadEndpoint props aligns with the migration to ToggleForm-based toggles with per-block endpoints. This simplification reduces coupling and improves component encapsulation.

src/routes/(authenticated)/projects/[id=idNumber]/+page.server.ts (2)

321-342: LGTM: Toggle action correctly implemented.

The toggleAutoPublishOnRebuild action follows the established pattern:

  • Security check properly enforces project write access
  • Form validation uses valibot schema for type safety
  • Database update targets the correct field

The field naming convention (camelCase for form, PascalCase for database) is consistent with other actions in this file.


343-364: LGTM: Toggle action correctly implemented.

The toggleRebuildOnSoftwareUpdate action mirrors the toggleAutoPublishOnRebuild implementation with proper security checks, form validation, and database updates.

src/lib/locales/en-US.json (2)

25-26: LGTM: Formatting improved for consistency.

The inline array format for declarations and selectors improves readability without changing semantics.

Also applies to: 35-36, 45-46, 55-56, 249-250


369-375: LGTM: Translation keys support new auto-publish/rebuild features.

The new keys are well-structured and follow the existing naming conventions. The descriptions clearly explain the feature behavior to users.

Note: Line 371 changes "Automatic Rebuilds" to "Automatic Rebuild" (singular), which may be intentional for consistency with the new "Rebuild on Software Update" feature.

Also applies to: 402-404

src/lib/locales/es-419.json (1)

25-26: LGTM: Formatting consistent with en-US.json.

The inline array format maintains consistency across locale files.

Also applies to: 35-36, 45-46, 55-56, 249-250

src/lib/locales/fr-FR.json (1)

369-370: LGTM: Translation keys added for consistency.

The new keys maintain consistency across locale files. Note that the values remain in English, which is consistent with other untranslated strings in this file.

Also applies to: 372-373, 398-400

src/routes/(authenticated)/organizations/[id=idNumber]/settings/products/+page.svelte (1)

6-6: LGTM: Migration to Toggle component.

The replacement of PublicPrivateToggle with the more flexible Toggle component is well-executed. The icon choices (mdi:lock-open-variant for public, mdi:lock for private) clearly communicate the toggle state.

Also applies to: 36-47

src/routes/(authenticated)/admin/settings/organizations/edit/+page.svelte (1)

7-7: LGTM: Consistent Toggle migration.

The migration from PublicPrivateToggle to Toggle follows the same pattern as other pages in this PR, with appropriate icon choices and proper form binding.

Also applies to: 103-111

src/lib/components/settings/ToggleForm.svelte (3)

11-39: LGTM: Well-defined component interface.

The Props interface clearly defines all required and optional properties. The use of ValueKey for title and message ensures type-safe localization.


48-64: Verify state management during error handling.

The error handling at lines 59-60 reverts the toggle state with formVar = !formVar. However, this might create unexpected behavior if the Toggle component has already updated formVar via the bind:checked directive before the form submission completes.

Consider testing this flow: Toggle on → form submits → server returns error → state reverted. Ensure the UI correctly reflects the reverted state.


66-79: LGTM: Clean Toggle integration.

The Toggle component is properly integrated with two-way binding and automatic form submission on change.

src/routes/(authenticated)/projects/[id=idNumber]/forms/Settings.svelte (3)

31-46: Public visibility block looks good.

Bindings, messages, icons, and endpoint wiring read clean and consistent.


33-81: No issues found—canEdit properly disables inputs end-to-end.

Verification confirms ToggleForm forwards canEdit to Toggle, which correctly sets disabled={!canEdit} on the input element. Visual feedback (opacity-50, pointer-events-none) reinforces the disabled state. The implementation is correct.


20-24: All server actions are properly defined and exported.

Verified that all four endpoints exist in +page.server.ts:

  • toggleVisibility (line 277)
  • toggleDownload (line 299)
  • toggleAutoPublishOnRebuild (line 321)
  • toggleRebuildOnSoftwareUpdate (line 343)

All action names match exactly and are exported within the actions object, so no 404 risk.

@judah-sotomayor
Copy link
Contributor Author

Latest changes ensure the toggles grey out when not enabled, and the locked cursor appears correctly now. I also replaced the custom toggle setup with DaisyUI's toggle label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rebuilds: Display/Edit options for project

2 participants