Skip to content

Commit

Permalink
refactor: move Space terms property to main Space type (#964)
Browse files Browse the repository at this point in the history
* refactor: move terms property to Space main type

* Update apps/ui/src/networks/common/graphqlApi/types.ts

Co-authored-by: Wiktor Tkaczyński <[email protected]>

---------

Co-authored-by: Wiktor Tkaczyński <[email protected]>
  • Loading branch information
wa0x6e and Sekhmet authored Nov 5, 2024
1 parent cc81127 commit 06b062c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions apps/ui/src/composables/useSpaceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export function useSpaceSettings(space: Ref<Space>) {
members.value = getInitialMembers(space.value);
parent.value = space.value.parent?.id ?? '';
children.value = space.value.children.map(child => child.id);
termsOfServices.value = space.value.additionalRawData?.terms ?? '';
termsOfServices.value = space.value.terms ?? '';
customDomain.value = space.value.additionalRawData?.domain ?? '';
isPrivate.value = space.value.additionalRawData?.private ?? false;
}
Expand Down Expand Up @@ -900,9 +900,7 @@ export function useSpaceSettings(space: Ref<Space>) {
return;
}

if (
termsOfServicesValue !== (space.value.additionalRawData?.terms ?? '')
) {
if (termsOfServicesValue !== (space.value.terms ?? '')) {
isModified.value = true;
return;
}
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/networks/common/graphqlApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ function formatSpace(
github: space.metadata.github,
twitter: space.metadata.twitter,
discord: space.metadata.discord,
terms: '',
voting_power_symbol: space.metadata.voting_power_symbol,
voting_types: constants.EDITOR_VOTING_TYPES,
treasuries: space.metadata.treasuries.map(treasury => {
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/offchain/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ function formatSpace(

const additionalRawData: OffchainAdditionalRawData = {
type: 'offchain',
terms: space.terms,
private: space.private,
domain: space.domain,
skin: space.skin,
Expand Down Expand Up @@ -209,6 +208,7 @@ function formatSpace(
voting_power_validation_strategies_parsed_metadata: [],
children: space.children.map(formatRelatedSpace),
parent: space.parent ? formatRelatedSpace(space.parent) : null,
terms: space.terms,
additionalRawData
};
}
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/offchain/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export type ApiSpace = {
followersCount: number;
children: [ApiRelatedSpace];
parent: ApiRelatedSpace | null;
// properties used for settings
terms: string;
// properties used for settings
private: boolean;
domain: string | null;
skin: string | null;
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export type OffchainAdditionalRawData = {
type: 'offchain';
} & Pick<
OffchainApiSpace,
| 'terms'
| 'private'
| 'domain'
| 'skin'
Expand Down Expand Up @@ -173,6 +172,7 @@ export type Space = {
github: string;
discord: string;
coingecko?: string;
terms: string;
voting_power_symbol: string;
controller: string;
voting_delay: number;
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const metadataForm: SpaceMetadata = reactive(
twitter: '',
github: '',
discord: '',
terms: '',
votingPowerSymbol: '',
treasuries: [],
labels: [],
Expand Down

0 comments on commit 06b062c

Please sign in to comment.