Skip to content

Commit

Permalink
feat: open server config from wiki list
Browse files Browse the repository at this point in the history
fixes #41
  • Loading branch information
linonetwo committed Feb 9, 2024
1 parent 9024f18 commit 970946d
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/pages/MainMenu/EditItemModel/WikiModelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { backgroundSyncService } from '../../../services/BackgroundSyncService';
import { useServerStore } from '../../../store/server';
import { IWikiWorkspace, useWorkspaceStore } from '../../../store/workspace';
import { deleteWikiFile } from '../../Config/Developer/useClearAllWikiData';
import { ServerEditModalContent } from '../../Config/ServerAndSync/ServerEditModal';
import { AddNewServerModelContent } from '../AddNewServerModelContent';
import { PerformanceToolsModelContent } from './PerformanceToolsModelContent';
import { WikiChangesModelContent } from './WikiChangesModelContent';
Expand All @@ -39,6 +40,8 @@ export function WikiEditModalContent({ id, onClose }: WikiEditModalProps): JSX.E
const [editedSelectiveSyncFilter, setEditedSelectiveSyncFilter] = useState(wiki?.selectiveSyncFilter ?? '');
const [editedWikiFolderLocation, setEditedWikiFolderLocation] = useState(wiki?.wikiFolderLocation ?? '');
const [newServerID, setNewServerID] = useState<string>('');
const [selectedServerID, setSelectedServerID] = useState<string | undefined>();
const [serverModalVisible, setServerModalVisible] = useState(false);
const [addServerModelVisible, setAddServerModelVisible] = useState(false);
const [wikiChangeLogModelVisible, setWikiChangeLogModelVisible] = useState(false);
const [performanceToolsModelVisible, setPerformanceToolsModelVisible] = useState(false);
Expand Down Expand Up @@ -102,23 +105,8 @@ export function WikiEditModalContent({ id, onClose }: WikiEditModalProps): JSX.E
}}
onLongPress={(server) => {
void Haptics.selectionAsync();
Alert.alert(
t('ConfirmDelete'),
t('ConfirmDeleteDescription'),
[
{
text: t('EditWorkspace.Cancel'),
onPress: () => {},
style: 'cancel',
},
{
text: t('Delete'),
onPress: () => {
handleRemoveServer(server.id);
},
},
],
);
setSelectedServerID(server.id);
setServerModalVisible(true);
}}
/>
<Picker
Expand Down Expand Up @@ -231,6 +219,19 @@ export function WikiEditModalContent({ id, onClose }: WikiEditModalProps): JSX.E
}}
/>
</Modal>
<Modal
visible={serverModalVisible}
onDismiss={() => {
setServerModalVisible(false);
}}
>
<ServerEditModalContent
id={selectedServerID}
onClose={() => {
setServerModalVisible(false);
}}
/>
</Modal>
</ThemeProvider>
</Portal>
</ModalContainer>
Expand Down

0 comments on commit 970946d

Please sign in to comment.