Cleaning
This commit is contained in:
64
src/lib/stores/uiState.svelte.ts
Normal file
64
src/lib/stores/uiState.svelte.ts
Normal file
@ -0,0 +1,64 @@
|
||||
type PanelPosition = 'left' | 'right' | 'bottom';
|
||||
|
||||
class UIState {
|
||||
sidePanelVisible = $state(true);
|
||||
sidePanelPosition = $state<PanelPosition>('right');
|
||||
|
||||
scopePopupVisible = $state(false);
|
||||
spectrogramPopupVisible = $state(false);
|
||||
sharePopupVisible = $state(false);
|
||||
audioPermissionPopupVisible = $state(true);
|
||||
unsavedChangesDialogVisible = $state(false);
|
||||
saveAsDialogVisible = $state(false);
|
||||
|
||||
shareUrl = $state('');
|
||||
|
||||
toggleSidePanel() {
|
||||
this.sidePanelVisible = !this.sidePanelVisible;
|
||||
}
|
||||
|
||||
cyclePanelPosition() {
|
||||
if (this.sidePanelPosition === 'right') {
|
||||
this.sidePanelPosition = 'left';
|
||||
} else if (this.sidePanelPosition === 'left') {
|
||||
this.sidePanelPosition = 'bottom';
|
||||
} else {
|
||||
this.sidePanelPosition = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
openScope() {
|
||||
this.scopePopupVisible = true;
|
||||
}
|
||||
|
||||
openSpectrogram() {
|
||||
this.spectrogramPopupVisible = true;
|
||||
}
|
||||
|
||||
showShare(url: string) {
|
||||
this.shareUrl = url;
|
||||
this.sharePopupVisible = true;
|
||||
}
|
||||
|
||||
closeAudioPermission() {
|
||||
this.audioPermissionPopupVisible = false;
|
||||
}
|
||||
|
||||
showUnsavedChangesDialog() {
|
||||
this.unsavedChangesDialogVisible = true;
|
||||
}
|
||||
|
||||
hideUnsavedChangesDialog() {
|
||||
this.unsavedChangesDialogVisible = false;
|
||||
}
|
||||
|
||||
showSaveAsDialog() {
|
||||
this.saveAsDialogVisible = true;
|
||||
}
|
||||
|
||||
hideSaveAsDialog() {
|
||||
this.saveAsDialogVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
export const uiState = new UIState();
|
||||
Reference in New Issue
Block a user