Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for namespace section #128

Merged
merged 3 commits into from
Dec 4, 2024
Merged

Conversation

aarongundel
Copy link
Collaborator

Form based editing of the namespace name (non-localized string)

@aarongundel aarongundel linked an issue Nov 18, 2024 that may be closed by this pull request
@aarongundel aarongundel marked this pull request as draft November 19, 2024 04:09
@aarongundel aarongundel force-pushed the adg/100-scheme-editor-side-panel branch 2 times, most recently from 7ea336a to b141d12 Compare November 21, 2024 17:52
@aarongundel aarongundel force-pushed the adg/125-namespace-section branch 2 times, most recently from b1bd6b2 to c408233 Compare November 21, 2024 18:31
@aarongundel aarongundel force-pushed the adg/100-scheme-editor-side-panel branch from b138af1 to 2b96c94 Compare December 3, 2024 17:38
@aarongundel aarongundel force-pushed the adg/125-namespace-section branch 2 times, most recently from 90428f9 to bf93afd Compare December 3, 2024 18:50
@aarongundel aarongundel marked this pull request as ready for review December 3, 2024 18:52
@aarongundel aarongundel requested a review from chrabyrd December 3, 2024 18:53
Copy link
Contributor

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looking good! Just a few minor things 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming Rob's ok with the model change, yeah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed this in a lingo standup, but I'll cc @robgaston just to make sure he's aware.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, all good!

@@ -0,0 +1,22 @@
<script lang="ts">
const UPDATE = "update";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah please roll back the declaring of emit values as constants. Much rather not have the two script tags

</script>
<template>
<div>
<div v-if="!props.mode || props.mode === 'view'">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would, however, recommend declaring view and edit as consts

@@ -0,0 +1,27 @@
<script lang="ts">
const UPDATE = "update";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same. please roll back the string-as-const so there's not two script tags.

@@ -17,37 +43,94 @@ const toggleSize = () => {
emit("side");
}
};

schemeComponents.map((x) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm typically against single-letter declarations as it makes the code harder to read.

@@ -17,37 +43,94 @@ const toggleSize = () => {
emit("side");
}
};

schemeComponents.map((x) => {
x.props.mode = "edit";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare edit as a const?

Comment on lines 26 to 31
props: {
mode: editMode,
},
on: {
update: onUpdated,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these may not need to be part of the component config if we expect every component to have the same props/on logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, I'll keep it simple till we need otherwise.

Comment on lines 30 to 49
const save = async () => {
await updateSchemeNamespace(
route.params.id as string,
schemeNamespace.value as SchemeNamespace,
);
};
const getSectionValue = async () => {
const response = await fetchSchemeNamespace(route.params.id as string);
schemeNamespace.value = response;
};

defineExpose({ save, getSectionValue });

onMounted(async () => {
getSectionValue();
});

const onNamespaceNameUpdate = (val: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say declare all functions with function foo() declarations, and put them on the bottom of the script tag so they're not mixed in with onMounted and defineExpose. There's an ordering of stuff in the script tag that I haven't promulgated yet, but for the time being IMO we should still be writing for readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough

@@ -1,5 +1,5 @@
import type { InjectionKey, Ref } from "vue";
import type { Language } from "@/arches_vue_utils/types";
import type { Language } from "@/arches_vue_utils/types.ts";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

@aarongundel aarongundel requested a review from chrabyrd December 3, 2024 22:27
@aarongundel aarongundel force-pushed the adg/100-scheme-editor-side-panel branch from 00ddb33 to d077e81 Compare December 3, 2024 23:00
Copy link
Contributor

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, just a few smaller things now

const VIEW = "view";
const EDIT = "edit";

type DataComponentMode = "edit" | "view";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, use the declared consts

import NonLocalizedStringViewer from "@/arches_lingo/components/generic/NonLocalizedStringViewer.vue";
import NonLocalizedStringEditor from "@/arches_lingo/components/generic/NonLocalizedStringEditor.vue";

type DataComponentMode = "edit" | "view";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with the declaring consts here

mode?: DataComponentMode;
}>();

defineEmits([OPEN_EDITOR]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, please revert OPEN_EDITOR to a string so there's no double-script-tag


<template>
<div>
<div v-if="!mode || mode === 'view'">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same with declaring the string as a const here and with edit

@aarongundel aarongundel force-pushed the adg/125-namespace-section branch from 90eccf0 to 95a97c5 Compare December 3, 2024 23:12
Base automatically changed from adg/100-scheme-editor-side-panel to main December 3, 2024 23:13
@aarongundel aarongundel force-pushed the adg/125-namespace-section branch from 95a97c5 to eb1fce7 Compare December 3, 2024 23:15
Copy link
Contributor

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 🚀

Copy link
Contributor

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 🚀

@aarongundel aarongundel merged commit 7f136e1 into main Dec 4, 2024
5 of 6 checks passed
@aarongundel aarongundel deleted the adg/125-namespace-section branch December 4, 2024 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Scheme Namespace" report/form section
3 participants