Skip to content

Commit

Permalink
refactor: pluralize module name
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Nov 12, 2024
1 parent 4b272c4 commit 0a996e0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
14 changes: 7 additions & 7 deletions apps/ui/src/components/ProposalsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<Choice | null>(null);
const space = computed(() => ({
Expand All @@ -28,16 +28,16 @@ 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;
}
modalOpenVote.value = true;
};
function handleAcceptTerms() {
termStore.accept(space.value);
termsStore.accept(space.value);
handleVoteClick(selectedChoice.value!);
}
</script>
Expand Down Expand Up @@ -85,9 +85,9 @@ function handleAcceptTerms() {
<teleport to="#modal">
<ModalTerms
v-if="proposal.space.terms"
:open="modalOpenTerm"
:open="modalOpenTerms"
:space="proposal.space"
@close="modalOpenTerm = false"
@close="modalOpenTerms = false"
@accept="handleAcceptTerms"
/>
<ModalVote
Expand Down
12 changes: 6 additions & 6 deletions apps/ui/src/stores/term.ts → apps/ui/src/stores/terms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ function getCompositeSpaceId(space: SpaceLikeEntity) {
return `${space.network}:${space.id}`;
}

export const useTermStore = defineStore('term', () => {
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
};
});
14 changes: 7 additions & 7 deletions apps/ui/src/views/Proposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<Choice | null>(null);
const { votes } = useAccount();
const editMode = ref(false);
Expand Down Expand Up @@ -66,16 +66,16 @@ 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;
}
modalOpenVote.value = true;
}
function handleAcceptTerms() {
termStore.accept(props.space);
termsStore.accept(props.space);
handleVoteClick(selectedChoice.value!);
}
Expand Down Expand Up @@ -360,9 +360,9 @@ watchEffect(() => {
<teleport to="#modal">
<ModalTerms
v-if="space.terms"
:open="modalOpenTerm"
:open="modalOpenTerms"
:space="space"
@close="modalOpenTerm = false"
@close="modalOpenTerms = false"
@accept="handleAcceptTerms"
/>
<ModalVote
Expand Down
14 changes: 7 additions & 7 deletions apps/ui/src/views/Space/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ const {
const proposalsStore = useProposalsStore();
const { votingPower, fetch: fetchVotingPower } = useVotingPower();
const { strategiesWithTreasuries } = useTreasuries(props.space);
const termStore = useTermStore();
const termsStore = useTermsStore();
const modalOpen = ref(false);
const modalOpenTerm = ref(false);
const modalOpenTerms = ref(false);
const previewEnabled = ref(false);
const sending = ref(false);
const enforcedVoteType = ref<VoteType | null>(null);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ async function handleProposeClick() {
}
function handleAcceptTerms() {
termStore.accept(props.space);
termsStore.accept(props.space);
handleProposeClick();
}
Expand Down Expand Up @@ -542,9 +542,9 @@ watchEffect(() => {
<teleport to="#modal">
<ModalTerms
v-if="space.terms"
:open="modalOpenTerm"
:open="modalOpenTerms"
:space="space"
@close="modalOpenTerm = false"
@close="modalOpenTerms = false"
@accept="handleAcceptTerms"
/>
<ModalDrafts
Expand Down

0 comments on commit 0a996e0

Please sign in to comment.