forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor stores, track help mode position, only drag from header
- Loading branch information
1 parent
262f165
commit a606d6d
Showing
8 changed files
with
146 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Stores Galaxy Help Mode's status | ||
*/ | ||
|
||
import { defineStore } from "pinia"; | ||
import { ref } from "vue"; | ||
|
||
// import { useHelpModeTextStore } from "./helpModeTextStore"; | ||
|
||
export const useHelpModeStatusStore = defineStore("helpModeStatusStore", () => { | ||
// TODO: Maybe `status` should be tracked in local storage? | ||
// const status: Ref<boolean> = useUserLocalStorage("help-mode-status", false); | ||
|
||
const status = ref(false); | ||
const position = ref({ x: 0, y: 0 }); | ||
|
||
// TODO: I removed the following since we now clear the text when we go away from | ||
// a component (the component is is destroyed) anyways. | ||
|
||
// Clear help mode text when help mode is disabled | ||
// watch(() => status.value, (newStatus) => { | ||
// status.value = newStatus; | ||
// if (!newStatus) { | ||
// useHelpModeTextStore().clearHelpModeText(); | ||
// } | ||
// }); | ||
|
||
return { | ||
status, | ||
position, | ||
}; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Stores Galaxy Help Mode's help content | ||
* TODO: Maybe this store is not needed and we have one singular `helpModeStore`? | ||
*/ | ||
|
||
import { defineStore } from "pinia"; | ||
import { ref } from "vue"; | ||
|
||
import config from "./helpTextConfig.yml"; | ||
|
||
const DEFAULT_HELP_TEXT = "Welcome to Galaxy Help Mode!"; | ||
|
||
export const useHelpModeTextStore = defineStore("helpModeTextStore", () => { | ||
// TODO: We can store multiple help mode texts in the following variable, referenced by "content ids". | ||
// Then, `storeHelpModeText` can be modified to accept an id, and fetch and store the corresponding | ||
// help mode text. Then maybe we could have a tabbed interface within the help mode, we would prevent | ||
// multiple fetched for the same component or it would still open up other possibilities... | ||
// const contents = ref({}); | ||
|
||
const content = ref(DEFAULT_HELP_TEXT); | ||
const loading = ref(false); | ||
|
||
/** Adds help mode text for the given Galaxy component `id` */ | ||
async function storeHelpModeText(id: string) { | ||
const file_path = config[id]; | ||
loading.value = true; | ||
await fetch("https://raw.githubusercontent.com/assuntad23/galaxy-help-markdown/main/" + file_path) | ||
.then((response) => response.text()) | ||
.then((text) => { | ||
content.value = text; | ||
loading.value = false; | ||
}); | ||
} | ||
|
||
function clearHelpModeText() { | ||
content.value = DEFAULT_HELP_TEXT; | ||
} | ||
|
||
return { | ||
content, | ||
loading, | ||
storeHelpModeText, | ||
clearHelpModeText, | ||
}; | ||
}); |