Skip to content

Commit

Permalink
Merge branch 'master' into refactor-vote-vp-composable
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e authored Dec 10, 2024
2 parents 7e20c4d + 96d9bfa commit c3a92dd
Show file tree
Hide file tree
Showing 45 changed files with 1,185 additions and 338 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function run() {
await sleep(PRODUCTION_INDEXER_DELAY);
}

await checkpoint.reset();
// await checkpoint.reset();
checkpoint.start();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@snapshot-labs/lock": "^0.2.10",
"@snapshot-labs/pineapple": "^1.1.0",
"@snapshot-labs/prettier-config": "^0.1.0-beta.18",
"@snapshot-labs/snapshot.js": "^0.12.33",
"@snapshot-labs/snapshot.js": "^0.12.36",
"@snapshot-labs/sx": "^0.1.0",
"@vueuse/core": "^10.4.1",
"@walletconnect/core": "^2.11.0",
Expand Down
151 changes: 151 additions & 0 deletions apps/ui/src/components/EditorTimeline.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<script setup lang="ts">
import { _d } from '@/helpers/utils';
import { offchainNetworks } from '@/networks';
import { Draft, Space } from '@/types';
type EditModalSettings = {
open: boolean;
editProperty: 'start' | 'min_end';
min?: number;
selected: number;
};
const MIN_VOTING_PERIOD = 60;
const proposal = defineModel<Draft>({
required: true
});
const props = defineProps<{
space: Space;
editable: boolean;
created: number;
start: number;
// eslint-disable-next-line vue/prop-name-casing
min_end: number;
// eslint-disable-next-line vue/prop-name-casing
max_end: number;
}>();
const { getDurationFromCurrent } = useMetaStore();
const editModalSettings = reactive<EditModalSettings>({
open: false,
editProperty: 'start',
selected: 0
});
const isOffchainSpace = computed(() =>
offchainNetworks.includes(props.space.network)
);
const minDates = computed(() => {
return {
start: props.created,
min_end: props.start + MIN_VOTING_PERIOD
};
});
function handleEditClick(type: 'start' | 'min_end') {
editModalSettings.selected = props[type];
editModalSettings.min = minDates.value[type];
editModalSettings.editProperty = type;
editModalSettings.open = true;
}
function handleDatePick(timestamp: number) {
if (
editModalSettings.editProperty === 'start' &&
proposal.value.min_end &&
timestamp >= proposal.value.min_end
) {
const customVotingPeriod = props.min_end - props.start;
proposal.value.min_end = timestamp + customVotingPeriod;
}
proposal.value[editModalSettings.editProperty] = timestamp;
}
function formatVotingDuration(
type: 'voting_delay' | 'min_voting_period' | 'max_voting_period'
): string {
const duration = getDurationFromCurrent(
props.space.network,
props.space[type]
);
const roundedDuration = Math.round(duration / 60) * 60;
return _d(roundedDuration);
}
</script>

<template>
<div>
<h4 class="eyebrow mb-2.5" v-text="'Timeline'" />
<ProposalTimeline
:data="
isOffchainSpace || !editable
? {
...space,
created,
start,
min_end,
max_end
}
: space
"
>
<template v-if="editable" #start-date-suffix>
<UiTooltip
v-if="space.voting_delay"
:title="`This space has enforced a ${formatVotingDuration('voting_delay')} voting delay`"
>
<IH-exclamation-circle />
</UiTooltip>
<button
v-else-if="isOffchainSpace"
class="text-skin-link"
@click="handleEditClick('start')"
v-text="'Edit'"
/>
</template>
<template v-if="editable" #end-date-suffix>
<UiTooltip
v-if="space.min_voting_period"
:title="`This space has enforced a ${formatVotingDuration('min_voting_period')} voting period`"
>
<IH-exclamation-circle />
</UiTooltip>
<button
v-else-if="isOffchainSpace"
class="text-skin-link"
@click="handleEditClick('min_end')"
v-text="'Edit'"
/>
</template>
<template v-if="editable && space.min_voting_period" #min_end-date-suffix>
<UiTooltip
:title="`This space has enforced a ${formatVotingDuration('min_voting_period')} minimum voting period`"
>
<IH-exclamation-circle />
</UiTooltip>
</template>
<template v-if="editable && space.max_voting_period" #max_end-date-suffix>
<UiTooltip
:title="`This space has enforced a ${formatVotingDuration('max_voting_period')} maximum voting period`"
>
<IH-exclamation-circle />
</UiTooltip>
</template>
</ProposalTimeline>
<teleport to="#modal">
<ModalDateTime
:min="editModalSettings.min"
:selected="editModalSettings.selected"
:open="editModalSettings.open"
@pick="handleDatePick"
@close="editModalSettings.open = false"
/>
</teleport>
</div>
</template>
3 changes: 2 additions & 1 deletion apps/ui/src/components/FormSpaceStrategies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const strategiesLimit = computed(() => {
tooltip:
'The default network used for this space. Networks can also be specified in individual strategies',
examples: ['Select network'],
networkId
networkId,
networksListKind: 'offchain'
}"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/components/Landing/Ecosystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<UiContainer class="!max-w-screen-lg">
<div class="max-w-[600px]">
<div class="eyebrow mb-3">Ecosystem</div>
<h1 class="mb-5 font-display !text-[44px]">
<h1 class="mb-5 font-display text-[36px] xs:text-[44px]">
Supercharge your governance with integrations
</h1>
<UiButton :to="{ name: 'site-ecosystem' }">
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/components/Landing/Features.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const FEATURES = [
<UiContainer class="!max-w-screen-lg">
<div class="pb-6 max-w-[600px]">
<div class="eyebrow mb-3">Features</div>
<h1 class="mb-4 font-display !text-[44px]">
<h1 class="mb-4 font-display text-[36px] xs:text-[44px]">
Everything DAOs need to make better decisions together
</h1>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/components/Landing/Flow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const STEPS = [
<template>
<div>
<UiContainer class="!max-w-screen-lg">
<h1 class="font-display max-w-[680px] py-9 !text-[44px]">
<h1 class="font-display max-w-[680px] py-9 text-[36px] xs:text-[44px]">
A fully integrated suite to manage DAO governance.
</h1>
</UiContainer>
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/components/Landing/Hero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>
<div class="max-w-[560px]">
<div class="eyebrow mb-3">Turn chaos to consensus</div>
<h1 class="mb-5 font-display !text-[56px]">
<h1 class="mb-5 font-display text-[40px] xs:text-[56px]">
The governance stack for your organization
</h1>
<UiButton :to="{ name: 'my-home' }" class="primary">
Expand Down
4 changes: 3 additions & 1 deletion apps/ui/src/components/Landing/Start.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<UiContainer class="!max-w-screen-lg">
<div class="text-center max-w-[600px] mx-auto">
<div class="eyebrow mb-3">Join Snapshot</div>
<h1 class="mb-4 font-display !text-[44px]">Ready to govern?</h1>
<h1 class="mb-4 font-display text-[36px] xs:text-[44px]">
Ready to govern?
</h1>
<UiButton :to="{ name: 'my-home' }" class="primary">
Get started
</UiButton>
Expand Down
8 changes: 2 additions & 6 deletions apps/ui/src/components/Layout/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ const hasTopNav = computed(() => {
return 'space-editor' !== String(route.matched[1]?.name);
});
const bottomPadding = computed(
() => !['space-proposal-votes'].includes(String(route.name))
);
async function handleTransactionAccept() {
if (
!walletConnectSpaceKey.value ||
Expand Down Expand Up @@ -165,7 +161,7 @@ router.afterEach(() => {
:class="{ 'overflow-clip': scrollDisabled }"
>
<UiLoading v-if="app.loading || !app.init" class="overlay big" />
<div v-else :class="['flex min-h-screen', { 'pb-6': bottomPadding }]">
<div v-else :class="['flex min-h-screen']">
<AppBottomNav
v-if="web3.account && !isWhiteLabel"
:class="[
Expand Down Expand Up @@ -209,7 +205,7 @@ router.afterEach(() => {
/>
<main class="flex-auto w-full flex">
<div class="flex-auto w-0 mt-[72px]">
<router-view />
<router-view class="pb-6" />
</div>
<div
v-if="hasPlaceHolderSidebar"
Expand Down
Loading

0 comments on commit c3a92dd

Please sign in to comment.