@t1mmen/srtd
Version:
Supabase Repeatable Template Definitions (srtd): ๐ช Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! ๐
52 lines โข 2.17 kB
JavaScript
// commands/index.tsx
import { Select } from '@inkjs/ui';
import { Box } from 'ink';
import React from 'react';
import Branding from '../components/Branding.js';
import Quittable from '../components/Quittable.js';
import Apply from './apply.js';
import Build from './build.js';
import Clear from './clear.js';
import Promote from './promote.js';
import Register from './register.js';
import Watch from './watch.js';
export default function UI() {
const [selectedCommand, setSelectedCommand] = React.useState(null);
const handleOnChange = async (value) => {
setSelectedCommand(value);
};
if (selectedCommand === 'register') {
return React.createElement(Register, { args: undefined });
}
if (selectedCommand === 'apply') {
return React.createElement(Apply, { options: { force: false } });
}
if (selectedCommand === 'build') {
return React.createElement(Build, { options: { force: false } });
}
if (selectedCommand === 'watch') {
return React.createElement(Watch, null);
}
if (selectedCommand === 'clear') {
return React.createElement(Clear, null);
}
if (selectedCommand === 'promote') {
return React.createElement(Promote, null);
}
const menuItems = [
{
label: '๐ watch - Watch for changes, apply directly to db',
value: 'watch',
},
{ label: 'โถ๏ธ apply - Apply templates directly to db', value: 'apply' },
{ label: '๐๏ธ build - Build templates as Supabase migrations', value: 'build' },
{ label: 'โ๏ธ register - Register templates as already built', value: 'register' },
{ label: '๐ promote - Promote WIP template to buildable templates', value: 'promote' },
{ label: '๐งน maintenance - Clear build logs and reset config', value: 'clear' },
];
return (React.createElement(Box, { flexDirection: "column" },
React.createElement(Branding, null),
React.createElement(Select, { visibleOptionCount: 10, options: menuItems, onChange: handleOnChange }),
React.createElement(Quittable, null)));
}
//# sourceMappingURL=index.js.map