mirror of
https://github.com/steel-dev/cli.git
synced 2026-09-14 20:47:34 +08:00
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
#!/usr/bin/env node
|
|
|
|
import React, {useState} from 'react';
|
|
import {Form} from 'ink-form';
|
|
import Callout from '../components/callout.js';
|
|
import {getSettings, setSettings} from '../utils/session.js';
|
|
|
|
export const description = 'Display current settings';
|
|
|
|
export default function Settings() {
|
|
const settings = getSettings();
|
|
const [sent, setSent] = useState(false);
|
|
return sent ? (
|
|
<Callout variant="success" title="Settings Updated">
|
|
Your settings have been saved successfully!
|
|
</Callout>
|
|
) : (
|
|
<Form
|
|
form={{
|
|
title: 'Settings',
|
|
sections: [
|
|
{
|
|
title: 'API Usage',
|
|
fields: [
|
|
{
|
|
name: 'instance',
|
|
label: 'Instance Type',
|
|
type: 'select',
|
|
required: true,
|
|
initialValue: settings?.instance || 'cloud',
|
|
options: [
|
|
{label: 'Cloud', value: 'cloud'},
|
|
{label: 'Local', value: 'local'},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}}
|
|
onSubmit={value => {
|
|
setSettings(value);
|
|
setSent(true);
|
|
}}
|
|
/>
|
|
);
|
|
}
|