mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 16:34:26 +00:00
Enable workspace renaming
This commit is contained in:
@@ -63,6 +63,7 @@ const Settings = () => {
|
|||||||
if (isInitialMount.current) {
|
if (isInitialMount.current) {
|
||||||
isInitialMount.current = false;
|
isInitialMount.current = false;
|
||||||
const settings = {
|
const settings = {
|
||||||
|
name: currentWorkspace.name,
|
||||||
theme: currentWorkspace.theme,
|
theme: currentWorkspace.theme,
|
||||||
autoSave: currentWorkspace.autoSave,
|
autoSave: currentWorkspace.autoSave,
|
||||||
gitEnabled: currentWorkspace.gitEnabled,
|
gitEnabled: currentWorkspace.gitEnabled,
|
||||||
@@ -82,6 +83,14 @@ const Settings = () => {
|
|||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
try {
|
try {
|
||||||
|
if (!state.localSettings.name?.trim()) {
|
||||||
|
notifications.show({
|
||||||
|
message: 'Workspace name cannot be empty',
|
||||||
|
color: 'red',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await updateSettings(state.localSettings);
|
await updateSettings(state.localSettings);
|
||||||
dispatch({ type: 'MARK_SAVED' });
|
dispatch({ type: 'MARK_SAVED' });
|
||||||
notifications.show({
|
notifications.show({
|
||||||
@@ -117,7 +126,10 @@ const Settings = () => {
|
|||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<GeneralSettings />
|
<GeneralSettings
|
||||||
|
name={state.localSettings.name}
|
||||||
|
onInputChange={handleInputChange}
|
||||||
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<AppearanceSettings
|
<AppearanceSettings
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Title, Box, TextInput, Text, Grid } from '@mantine/core';
|
import { Title, Box, TextInput, Text, Grid } from '@mantine/core';
|
||||||
import { useWorkspace } from '../../contexts/WorkspaceContext';
|
|
||||||
|
|
||||||
const GeneralSettings = ({ onInputChange }) => {
|
|
||||||
const { currentWorkspace } = useWorkspace();
|
|
||||||
|
|
||||||
|
const GeneralSettings = ({ name, onInputChange }) => {
|
||||||
return (
|
return (
|
||||||
<Box mb="md">
|
<Box mb="md">
|
||||||
<Title order={3} mb="md">
|
<Title order={3} mb="md">
|
||||||
@@ -17,11 +14,12 @@ const GeneralSettings = ({ onInputChange }) => {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<TextInput
|
<TextInput
|
||||||
value={currentWorkspace?.name || ''}
|
value={name || ''}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
onInputChange('name', event.currentTarget.value)
|
onInputChange('name', event.currentTarget.value)
|
||||||
}
|
}
|
||||||
placeholder="Enter workspace name"
|
placeholder="Enter workspace name"
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user