feat (ui): File picker for scheduling recipes default to recipe dir (#3611)

This commit is contained in:
Angela Ning
2025-07-28 15:39:15 -04:00
committed by GitHub
parent 959f51ffc4
commit 7e98329093
6 changed files with 54 additions and 22 deletions
@@ -6,6 +6,7 @@ import { Select } from '../ui/Select';
import cronstrue from 'cronstrue';
import * as yaml from 'yaml';
import { Recipe, decodeRecipe } from '../../recipe';
import { getStorageDirectory } from '../../recipe/recipeStorage';
import ClockIcon from '../../assets/clock-icon.svg';
type FrequencyValue = 'once' | 'every' | 'daily' | 'weekly' | 'monthly';
@@ -361,7 +362,9 @@ export const CreateScheduleModal: React.FC<CreateScheduleModalProps> = ({
};
const handleBrowseFile = async () => {
const filePath = await window.electron.selectFileOrDirectory();
// Default to global recipes directory, but fallback to local if needed
const defaultPath = getStorageDirectory(true);
const filePath = await window.electron.selectFileOrDirectory(defaultPath);
if (filePath) {
if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
setRecipeSourcePath(filePath);