refactor: classic.sidebar.vue to composition api #59

Merged
Johann150 merged 3 commits from :refactor/classic.sidebar.vue into main 2022-08-09 21:25:02 +00:00
Owner
No description provided.
norm added 1 commit 2022-08-08 00:33:32 +00:00
refactor: classic.sidebar.vue to composition api
Some checks failed
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
5b83c8b2a1
norm added 1 commit 2022-08-08 00:38:22 +00:00
Use optional chaining for onMounted sidebar
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
9f532e37e7
Johann150 reviewed 2022-08-08 09:36:55 +00:00
@ -104,0 +61,4 @@
}
return false;
});
const adminOrModerator = $computed(() => $i && ($i.isAdmin || $i.isModerator));
Owner

You can use iAmModerator from @/account instead.

You can use `iAmModerator` from `@/account` instead.
norm marked this conversation as resolved
@ -104,0 +67,4 @@
(ev: 'change-view-mode'): void;
}>();
watch(() => defaultStore.reactiveState.menuDisplay.value, () => {
Owner

You are using a getter of a ref value¹, but you could use the ref directly here², like this:

watch(defaultStore.reactiveState.menuDisplay, () => {

¹ According to the type definition of reactiveState it is a Ref.

² See type definition of watch: https://vuejs.org/api/reactivity-core.html#watch

You are using a getter of a ref value¹, but you could use the ref directly here², like this: ```ts watch(defaultStore.reactiveState.menuDisplay, () => { ``` --- <small> ¹ According to the [type definition of `reactiveState`](https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/cbefddc07148d59e643bc91f9ceb1d7fa3553255/packages/client/src/pizzax.ts#L25) it is a `Ref`. ² See type definition of `watch`: https://vuejs.org/api/reactivity-core.html#watch </small>
Owner

I'm also thinking that the arrow function to call calcViewState is unnecessary and you could probably just put the function name directly.

I'm also thinking that the arrow function to call `calcViewState` is unnecessary and you could probably just put the function name directly.
norm marked this conversation as resolved
@ -136,0 +92,4 @@
}
function post(): void {
os.post();
Owner

This function seems quite simple, just to not upset the os.post function by passing the event data as parameters. Maybe it could be "inlined" in the template as an arrow function?

This function seems quite simple, just to not upset the `os.post` function by passing the event data as parameters. Maybe it could be "inlined" in the template as an arrow function?
norm marked this conversation as resolved
@ -136,0 +95,4 @@
os.post();
}
function more(ev: { currentTarget: any; target: any; }): void {
Owner

Wouldn't MouseEvent be the right type to use here as well?

Wouldn't `MouseEvent` be the right type to use here as well?
norm marked this conversation as resolved
@ -136,0 +108,4 @@
}
window.addEventListener('resize', calcViewState);
calcViewState();
Owner

Maybe group these uses of calcViewState with the function definition above since they are related.

Maybe group these uses of `calcViewState` with the function definition above since they are related.
norm marked this conversation as resolved
norm added 1 commit 2022-08-08 10:25:40 +00:00
Address review feedback
Some checks failed
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
16391dfc08
Johann150 merged commit 7f5d7ffd93 into main 2022-08-09 21:25:02 +00:00
norm deleted branch refactor/classic.sidebar.vue 2022-08-11 10:24:36 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#59
No description provided.