Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Jan 5, 2025
1 parent fedefb6 commit 5bb96a4
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 14 deletions.
11 changes: 9 additions & 2 deletions apps/ui/src/components/FormSpaceVoting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ import {
import { _d } from '@/helpers/utils';
import { getValidator } from '@/helpers/validation';
import { getNetwork, offchainNetworks } from '@/networks';
import { ChainId, Space, Validation, VoteType } from '@/types';
import {
ChainId,
Privacy,
Space,
SpacePrivacy,
Validation,
VoteType
} from '@/types';
const votingDelay = defineModel<number | null>('votingDelay', {
required: true
Expand All @@ -28,7 +35,7 @@ const quorum = defineModel<string | number>('quorum', {
const votingType = defineModel<VoteType | 'any'>('votingType', {
required: true
});
const privacy = defineModel<'none' | 'shutter' | 'any'>('privacy', {
const privacy = defineModel<SpacePrivacy>('privacy', {
required: true
});
const voteValidation = defineModel<Validation>('voteValidation', {
Expand Down
9 changes: 4 additions & 5 deletions apps/ui/src/components/Modal/SelectPrivacy.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<script setup lang="ts">
import { PRIVACY_TYPES_INFO } from '@/helpers/constants';
type Privacy = 'none' | 'shutter' | 'any';
import { SpacePrivacy } from '@/types';
const votingTypes = ['any', 'shutter', 'none'] as const;
defineProps<{
open: boolean;
initialState?: Privacy;
initialState?: SpacePrivacy;
}>();
const emit = defineEmits<{
(e: 'save', type: Privacy);
(e: 'save', type: SpacePrivacy);
(e: 'close');
}>();
function handleSelect(type: Privacy) {
function handleSelect(type: SpacePrivacy) {
emit('save', type);
emit('close');
}
Expand Down
3 changes: 2 additions & 1 deletion apps/ui/src/composables/useSpaceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Space,
SpaceMetadata,
SpaceMetadataLabel,
SpacePrivacy,
StrategyParsedMetadata,
Validation
} from '@/types';
Expand Down Expand Up @@ -161,7 +162,7 @@ export function useSpaceSettings(space: Ref<Space>) {
| 'weighted'
| 'basic'
);
const privacy = ref('none' as 'none' | 'shutter' | 'any');
const privacy = ref('none' as SpacePrivacy);
const voteValidation = ref({ name: 'any', params: {} } as Validation);
const ignoreAbstainVotes = ref(false);
const snapshotChainId: Ref<number> = ref(1);
Expand Down
10 changes: 8 additions & 2 deletions apps/ui/src/helpers/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ChainId, NetworkID, VoteType, VoteTypeInfo } from '@/types';
import {
ChainId,
NetworkID,
SpacePrivacy,
VoteType,
VoteTypeInfo
} from '@/types';

export const APP_NAME = 'Snapshot';

Expand Down Expand Up @@ -99,7 +105,7 @@ export const VOTING_TYPES_INFO: Record<
};

export const PRIVACY_TYPES_INFO: Record<
'none' | 'shutter' | 'any',
SpacePrivacy,
{ label: string; description?: string }
> = {
none: {
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/offchain/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { getProvider } from '@/helpers/provider';
import {
Choice,
NetworkID,
Privacy,
Proposal,
Space,
Statement,
Expand All @@ -30,7 +31,6 @@ import {
} from '@/types';
import { EDITOR_SNAPSHOT_OFFSET } from './constants';
import { getSdkChoice } from './helpers';
import { Privacy } from '../../types';
import { EDITOR_APP_NAME } from '../common/constants';
import {
Connector,
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Web3Provider } from '@ethersproject/providers';
import { Wallet } from '@ethersproject/wallet';
import { Privacy } from '@snapshot-labs/sx';
import { FunctionalComponent } from 'vue';
import {
Alias,
Expand All @@ -9,6 +8,7 @@ import {
DelegationType,
Follow,
NetworkID,
Privacy,
Proposal,
Space,
SpaceMetadata,
Expand Down
3 changes: 2 additions & 1 deletion apps/ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type Choice =
| Record<string, number>;

export type Privacy = 'shutter' | 'none';
export type SpacePrivacy = Privacy | 'any';

export type VoteType =
| 'basic'
Expand Down Expand Up @@ -174,7 +175,7 @@ export type Space = {
discord: string;
coingecko?: string;
terms: string;
privacy: 'none' | 'shutter' | 'any';
privacy: SpacePrivacy;
voting_power_symbol: string;
active_proposals: number | null;
controller: string;
Expand Down
1 change: 0 additions & 1 deletion apps/ui/src/views/Space/Editor.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { computed, ref, watchEffect } from 'vue';
import { LocationQueryValue } from 'vue-router';
import { StrategyWithTreasury } from '@/composables/useTreasuries';
import {
Expand Down

0 comments on commit 5bb96a4

Please sign in to comment.