Skip to content

Commit

Permalink
refactor(problem): sync changes with backend (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 authored Dec 3, 2024
1 parent 8b3774d commit 0bf2284
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 415 deletions.
9 changes: 9 additions & 0 deletions .changes/refactor-problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"algohub": patch:refactor
---

Fully refactored the problem api to sync changes with the `algohub-server`, also:

- Fixed icon sizes in markdown editor.
- Extract supported languages from ts enum.
- Refactored problem editor.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/components/MarkdownEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ const themeStore = useThemeStore();
'preview',
'previewOnly',
]"></MdEditor>
</template>
</template>

<style scoped>
:deep(svg.md-editor-icon) {
width: revert-layer;
height: revert-layer;
}
</style>
14 changes: 7 additions & 7 deletions src/components/MonacoEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onMounted(async () => {
loader.config({ monaco })
editor.value = await loader.init().then((monaco) => monaco.editor.create(editorContainer.value, {
value: '',
language: 'rust',
language: language.value,
theme: themeStore.dark ? 'vs-dark' : 'vs',
fontFamily: 'Cascadia Code, Consolas, Menlo, Monaco, "Courier New", monospace',
inlineSuggest: {
Expand All @@ -77,12 +77,12 @@ onUnmounted(disposeEditor)
onBeforeUnmount(disposeEditor)
onBeforeRouteLeave(disposeEditor)
const languageOptions = [
{ name: 'Rust', value: Language.Rust },
{ name: 'Python', value: Language.Python },
{ name: 'C', value: Language.C },
{ name: 'C++', value: Language.Cpp },
]
console.log(Language)
console.log(Object.values(Language))
console.log(Object.keys(Language))
console.log(Object.entries(Language))
const languageOptions = Object.entries(Language).map(([name, value]) => ({ name, value }))
const onChangeLanguage = (value: SelectChangeEvent) => {
const editor = rawEditor.value;
Expand Down
Loading

0 comments on commit 0bf2284

Please sign in to comment.