Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions apps/differ/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ fn list_directory(path: String) -> Result<Vec<DirEntry>, String> {
}
}

dirs.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
files.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
dirs.sort_by_key(|a| a.name.to_lowercase());
files.sort_by_key(|a| a.name.to_lowercase());
dirs.extend(files);
Ok(dirs)
}
Expand Down
9 changes: 8 additions & 1 deletion apps/staged/src-tauri/src/blox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
//! Thin wrappers around shared `blox-cli` helpers so existing Staged code can
//! keep using `crate::blox::*`.

use std::sync::OnceLock;

pub use blox_cli::{BloxError, WorkspaceCommand, WorkspaceInfo, WorkspaceListEntry};

static SQ_AVAILABLE: OnceLock<bool> = OnceLock::new();

/// Check whether the `sq` CLI is available on this system.
///
/// The result is cached for the lifetime of the process since the PATH
/// won't change mid-session.
pub fn is_sq_available() -> bool {
blox_cli::is_sq_available()
*SQ_AVAILABLE.get_or_init(blox_cli::is_sq_available)
}

/// Start a new Blox workspace.
Expand Down
18 changes: 17 additions & 1 deletion apps/staged/src-tauri/src/session_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,23 @@ pub fn start_session(
log::info!("Drained next queued session for branch {branch_id}");
}
Ok(false) => {
if let Some(auto_review_branch_id) = auto_review_branch_id {
// Check if auto-review is enabled in user preferences
let auto_review_enabled = crate::preferences_store_path_buf()
.and_then(|path| std::fs::read_to_string(&path).ok())
.and_then(|contents| {
serde_json::from_str::<serde_json::Value>(&contents).ok()
})
.and_then(|json| {
json.get("auto-start-code-reviews")?
.as_str()
.map(String::from)
})
.map(|mode| mode != "never")
.unwrap_or_else(crate::blox::is_sq_available);

if let Some(auto_review_branch_id) =
auto_review_branch_id.filter(|_| auto_review_enabled)
{
match crate::session_commands::trigger_auto_review(
store_for_follow_up,
registry_for_follow_up,
Expand Down
2 changes: 2 additions & 0 deletions apps/staged/src/lib/features/diff/highlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export {
getSyntaxThemeName,
setSyntaxTheme,
isLightTheme,
loadAllThemePreviewColors,
SYNTAX_THEMES,
type Token,
type HighlighterTheme,
type ThemePreviewColors,
type SyntaxThemeName,
} from '@builderbot/diff-viewer/utils';
23 changes: 4 additions & 19 deletions apps/staged/src/lib/features/layout/TopBar.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<!--
TopBar.svelte - Minimal top bar with drag region, theme selector, and new project button
TopBar.svelte - Minimal top bar with drag region, settings, and new project button

Provides a drag region for window movement, a theme picker, and a "+" button
for adding new projects.
Provides a drag region for window movement, a "+" button for adding new
projects, and a settings button.
-->
<script lang="ts">
import { onMount } from 'svelte';
import { Palette, PanelLeftClose, PanelLeftOpen, Plus, SlidersHorizontal } from 'lucide-svelte';
import { PanelLeftClose, PanelLeftOpen, Plus, SlidersHorizontal } from 'lucide-svelte';
import { getCurrentWindow } from '@tauri-apps/api/window';
import ThemeSelectorModal from '../settings/ThemeSelectorModal.svelte';
import { navigation, openSettings } from './navigation.svelte';
import {
hydrateProjectsSidebarState,
projectsSidebarState,
setProjectsSidebarCollapsed,
} from '../projects/projectsSidebarState.svelte';

let showThemeModal = $state(false);

onMount(() => {
void hydrateProjectsSidebarState();
});
Expand Down Expand Up @@ -68,21 +65,9 @@
<Plus size={14} />
</button>

<button
class="icon-btn theme-btn"
onclick={() => (showThemeModal = !showThemeModal)}
title="Select theme"
>
<Palette size={14} />
</button>

<button class="icon-btn" onclick={() => openSettings()} title="Settings (⌘,)">
<SlidersHorizontal size={14} />
</button>

{#if showThemeModal}
<ThemeSelectorModal onClose={() => (showThemeModal = false)} />
{/if}
</div>
</div>

Expand Down
6 changes: 3 additions & 3 deletions apps/staged/src/lib/features/layout/navigation.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import { projectsList } from '../projects/projectsSidebarState.svelte';

const LAST_PROJECT_STORE_KEY = 'last-viewed-project';

export type SettingsSection = 'repo' | 'keyboard' | 'doctor';
export type SettingsSection = 'general' | 'repo' | 'keyboard' | 'doctor';

export const navigation = $state({
activeView: 'workspace' as 'workspace' | 'settings',
selectedProjectId: null as string | null,
settingsSection: 'repo' as SettingsSection,
settingsSection: 'general' as SettingsSection,
});

function showWorkspaceView(): void {
Expand Down Expand Up @@ -134,7 +134,7 @@ export function goHome(): void {
}

/** Show the dedicated settings view and select a settings section. */
export function openSettings(section: SettingsSection = 'repo'): void {
export function openSettings(section: SettingsSection = 'general'): void {
navigation.settingsSection = section;
navigation.activeView = 'settings';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@
<div class="panel-intro">
<h2>
<FolderGit2 size={16} />
Repo
Repos
</h2>
<p>Manage per-repo actions and remove repos from Staged when they are no longer needed.</p>
</div>
Expand Down
Loading