From 0a996e025bb3e7f9656f51eadcebe3c5bd806971 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:34:01 +0900 Subject: [PATCH] refactor: pluralize module name --- apps/ui/src/components/ProposalsListItem.vue | 14 +++++++------- apps/ui/src/stores/{term.ts => terms.ts} | 12 ++++++------ apps/ui/src/views/Proposal.vue | 14 +++++++------- apps/ui/src/views/Space/Editor.vue | 14 +++++++------- 4 files changed, 27 insertions(+), 27 deletions(-) rename apps/ui/src/stores/{term.ts => terms.ts} (51%) diff --git a/apps/ui/src/components/ProposalsListItem.vue b/apps/ui/src/components/ProposalsListItem.vue index a8c38a308..0a83e3aaa 100644 --- a/apps/ui/src/components/ProposalsListItem.vue +++ b/apps/ui/src/components/ProposalsListItem.vue @@ -9,10 +9,10 @@ const props = defineProps<{ const { modalAccountOpen } = useModal(); const { web3 } = useWeb3(); -const termStore = useTermStore(); +const termsStore = useTermsStore(); const modalOpenVote = ref(false); -const modalOpenTerm = ref(false); +const modalOpenTerms = ref(false); const selectedChoice = ref(null); const space = computed(() => ({ @@ -28,8 +28,8 @@ const handleVoteClick = (choice: Choice) => { selectedChoice.value = choice; - if (props.proposal.space.terms && !termStore.isAccepted(space.value)) { - modalOpenTerm.value = true; + if (props.proposal.space.terms && !termsStore.areAccepted(space.value)) { + modalOpenTerms.value = true; return; } @@ -37,7 +37,7 @@ const handleVoteClick = (choice: Choice) => { }; function handleAcceptTerms() { - termStore.accept(space.value); + termsStore.accept(space.value); handleVoteClick(selectedChoice.value!); } @@ -85,9 +85,9 @@ function handleAcceptTerms() { { - const termAcceptedIds = useStorage(`${pkg.name}.term`, [] as string[]); +export const useTermsStore = defineStore('terms', () => { + const termsAcceptedIds = useStorage(`${pkg.name}.terms`, [] as string[]); function accept(space: SpaceLikeEntity) { - termAcceptedIds.value.push(getCompositeSpaceId(space)); + termsAcceptedIds.value.push(getCompositeSpaceId(space)); } - function isAccepted(space: SpaceLikeEntity) { - return termAcceptedIds.value.includes(getCompositeSpaceId(space)); + function areAccepted(space: SpaceLikeEntity) { + return termsAcceptedIds.value.includes(getCompositeSpaceId(space)); } return { accept, - isAccepted + areAccepted }; }); diff --git a/apps/ui/src/views/Proposal.vue b/apps/ui/src/views/Proposal.vue index d0f0256ce..9aac8c7ad 100644 --- a/apps/ui/src/views/Proposal.vue +++ b/apps/ui/src/views/Proposal.vue @@ -18,10 +18,10 @@ const { const { setTitle } = useTitle(); const { web3 } = useWeb3(); const { modalAccountOpen } = useModal(); -const termStore = useTermStore(); +const termsStore = useTermsStore(); const modalOpenVote = ref(false); -const modalOpenTerm = ref(false); +const modalOpenTerms = ref(false); const selectedChoice = ref(null); const { votes } = useAccount(); const editMode = ref(false); @@ -66,8 +66,8 @@ async function handleVoteClick(choice: Choice) { selectedChoice.value = choice; - if (props.space.terms && !termStore.isAccepted(props.space)) { - modalOpenTerm.value = true; + if (props.space.terms && !termsStore.areAccepted(props.space)) { + modalOpenTerms.value = true; return; } @@ -75,7 +75,7 @@ async function handleVoteClick(choice: Choice) { } function handleAcceptTerms() { - termStore.accept(props.space); + termsStore.accept(props.space); handleVoteClick(selectedChoice.value!); } @@ -360,9 +360,9 @@ watchEffect(() => { (null); @@ -170,8 +170,8 @@ const proposalLimitReached = computed( async function handleProposeClick() { if (!proposal.value) return; - if (props.space.terms && !termStore.isAccepted(props.space)) { - modalOpenTerm.value = true; + if (props.space.terms && !termsStore.areAccepted(props.space)) { + modalOpenTerms.value = true; return; } @@ -244,7 +244,7 @@ async function handleProposeClick() { } function handleAcceptTerms() { - termStore.accept(props.space); + termsStore.accept(props.space); handleProposeClick(); } @@ -542,9 +542,9 @@ watchEffect(() => {