@meddleware/dao-ui 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +28 -6
- package/src/App.vue +7 -3
- package/src/DaoView.vue +8 -16
- package/src/components/ProposalRow.vue +63 -36
- package/src/composables/useDaoEvents.ts +3 -2
- package/src/composables/useEpoch.ts +3 -2
- package/src/composables/useGates.ts +4 -3
- package/src/composables/usePlatformConfig.ts +3 -2
- package/src/styles/qt.css +61 -231
- package/src/tabs/GovernanceTab.vue +42 -28
- package/src/tabs/HistoryTab.vue +76 -59
- package/src/tabs/OverviewTab.vue +38 -39
- package/src/tabs/ProposalsTab.vue +9 -14
- package/src/tabs/TreasuryTab.vue +23 -22
- package/src/components/DataTable.vue +0 -26
- package/src/components/Panel.vue +0 -13
- package/src/components/StatusBar.vue +0 -36
- package/src/components/TabBar.vue +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/dao-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"homepage": "https://docs.meddleware.co.uk/blockchain/sui/dao/",
|
|
5
5
|
"description": "Meddleware DAO console — treasury overview, proposals, and governance on Sui.",
|
|
6
6
|
"author": "Meddleware <dev@meddleware.co.uk>",
|
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
"preview": "vite preview",
|
|
24
24
|
"type-check": "vue-tsc --noEmit",
|
|
25
25
|
"test": "vitest run",
|
|
26
|
-
"test:watch": "vitest"
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"lint:css": "stylelint \"src/**/*.{css,vue}\"",
|
|
28
|
+
"lint:js": "eslint .",
|
|
29
|
+
"lint": "npm run lint:css && npm run lint:js && npm run lint:html",
|
|
30
|
+
"lint:html": "html-validate \"src/**/*.vue\""
|
|
27
31
|
},
|
|
28
32
|
"exports": {
|
|
29
33
|
".": {
|
|
@@ -40,23 +44,41 @@
|
|
|
40
44
|
"access": "public"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@meddleware/design-tokens": "^0.1.
|
|
44
|
-
"@meddleware/ui": "^0.1.
|
|
45
|
-
"@meddleware/wallet-adapter": "^0.0.
|
|
47
|
+
"@meddleware/design-tokens": "^0.1.7",
|
|
48
|
+
"@meddleware/ui": "^0.1.28",
|
|
49
|
+
"@meddleware/wallet-adapter": "^0.0.9",
|
|
46
50
|
"@mysten/sui": "^2.31.0",
|
|
47
51
|
"vue": "^3.5.43"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
50
54
|
"@types/node": "~24.12.2",
|
|
51
55
|
"@vitejs/plugin-vue": "^6.0.9",
|
|
56
|
+
"@vue/eslint-config-typescript": "^14.9.0",
|
|
52
57
|
"@vue/test-utils": "^2.5.1",
|
|
58
|
+
"autoprefixer": "^10.4.20",
|
|
59
|
+
"eslint": "^10.11.0",
|
|
60
|
+
"eslint-plugin-vue": "^10.11.1",
|
|
61
|
+
"eslint-plugin-vuejs-accessibility": "^2.6.0",
|
|
62
|
+
"html-validate": "^11.16.0",
|
|
63
|
+
"html-validate-vue": "^9.3.1",
|
|
64
|
+
"jiti": "^2.7.0",
|
|
53
65
|
"jsdom": "^29.1.1",
|
|
66
|
+
"postcss": "^8.4.49",
|
|
67
|
+
"postcss-html": "^2.0.0",
|
|
68
|
+
"stylelint": "^17.15.0",
|
|
69
|
+
"stylelint-config-standard": "^40.0.0",
|
|
54
70
|
"typescript": "~6.0.0",
|
|
55
71
|
"vite": "^8.3.0",
|
|
56
72
|
"vitest": "~5.0.1",
|
|
73
|
+
"vue-eslint-parser": "^10.4.1",
|
|
57
74
|
"vue-tsc": "~3.3.11"
|
|
58
75
|
},
|
|
59
76
|
"engines": {
|
|
60
77
|
"node": "^22.18.0 || >=24.12.0"
|
|
61
|
-
}
|
|
78
|
+
},
|
|
79
|
+
"browserslist": [
|
|
80
|
+
"> 0.5%",
|
|
81
|
+
"last 2 versions",
|
|
82
|
+
"not dead"
|
|
83
|
+
]
|
|
62
84
|
}
|
package/src/App.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
// Standalone shell for the DAO SPA. The core UI lives in DaoView.vue (also exported
|
|
3
3
|
// for inline embedding in the dashboard).
|
|
4
|
-
import { AppHeader, AppFooter, ColorModeControl, useColorMode } from '@meddleware/ui'
|
|
4
|
+
import { AppHeader, AppFooter, ColorModeControl, CopyrightLine, useColorMode } from '@meddleware/ui'
|
|
5
5
|
import { NETWORK } from './config.js'
|
|
6
6
|
import DaoView from './DaoView.vue'
|
|
7
7
|
|
|
@@ -22,9 +22,13 @@ const DEV_URL = import.meta.env.VITE_DEV_URL || 'https://dev.meddleware.co.uk/
|
|
|
22
22
|
</template>
|
|
23
23
|
</AppHeader>
|
|
24
24
|
|
|
25
|
-
<DaoView
|
|
25
|
+
<DaoView />
|
|
26
26
|
|
|
27
|
-
<AppFooter :docs-url="DOCS_URL" :dev-url="DEV_URL"
|
|
27
|
+
<AppFooter :docs-url="DOCS_URL" :dev-url="DEV_URL">
|
|
28
|
+
<template #start>
|
|
29
|
+
<CopyrightLine symbol-variant="kopimi" organisation-name="Meddleware" rights-statement="jam" />
|
|
30
|
+
</template>
|
|
31
|
+
</AppFooter>
|
|
28
32
|
</div>
|
|
29
33
|
</template>
|
|
30
34
|
|
package/src/DaoView.vue
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
// DaoView is consumed as a library by the dashboard or any other host.
|
|
8
8
|
import './styles/qt.css'
|
|
9
9
|
import { ref, computed } from 'vue'
|
|
10
|
-
import
|
|
11
|
-
import StatusBar from './components/StatusBar.vue'
|
|
10
|
+
import { AppTabNav, UiStatusBar, UiTabPanel, UiToolbar, type AppTab } from '@meddleware/ui'
|
|
12
11
|
import OverviewTab from './tabs/OverviewTab.vue'
|
|
13
12
|
import TreasuryTab from './tabs/TreasuryTab.vue'
|
|
14
13
|
import ProposalsTab from './tabs/ProposalsTab.vue'
|
|
@@ -16,10 +15,9 @@ import GovernanceTab from './tabs/GovernanceTab.vue'
|
|
|
16
15
|
import HistoryTab from './tabs/HistoryTab.vue'
|
|
17
16
|
import { useDaoEvents } from './composables/useDaoEvents.js'
|
|
18
17
|
import { useEpoch } from './composables/useEpoch.js'
|
|
18
|
+
import { NETWORK } from './config.js'
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const TABS: Tab[] = [
|
|
20
|
+
const TABS: AppTab[] = [
|
|
23
21
|
{ id: 'overview', label: 'Overview' },
|
|
24
22
|
{ id: 'treasury', label: 'Treasury' },
|
|
25
23
|
{ id: 'proposals', label: 'Proposals' },
|
|
@@ -45,20 +43,14 @@ const { epoch } = useEpoch()
|
|
|
45
43
|
|
|
46
44
|
<template>
|
|
47
45
|
<div class="dao-view">
|
|
48
|
-
<
|
|
49
|
-
<button class="dao-toolbar__btn" @click="activeTab = 'overview'">🏛 Meddleware DAO</button>
|
|
50
|
-
</div>
|
|
46
|
+
<UiToolbar :actions="[{ id: 'home', label: '🏛 Meddleware DAO' }]" @action="activeTab = 'overview'" />
|
|
51
47
|
|
|
52
|
-
<
|
|
48
|
+
<AppTabNav v-model="activeTab" :tabs="TABS" id-prefix="dao" variant="raised" aria-label="DAO sections" />
|
|
53
49
|
|
|
54
|
-
<
|
|
50
|
+
<UiTabPanel id-prefix="dao" :tab="activeTab" class="dao-content">
|
|
55
51
|
<component :is="activeComponent" />
|
|
56
|
-
</
|
|
52
|
+
</UiTabPanel>
|
|
57
53
|
|
|
58
|
-
<
|
|
59
|
-
:epoch="epoch"
|
|
60
|
-
:last-refresh="lastRefresh"
|
|
61
|
-
:error="!!eventsError"
|
|
62
|
-
/>
|
|
54
|
+
<UiStatusBar :network="NETWORK" :healthy="!eventsError" :epoch="epoch" :last-refresh="lastRefresh" />
|
|
63
55
|
</div>
|
|
64
56
|
</template>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Renders one fundraising/governance proposal: status badge, progress toward target,
|
|
3
3
|
// and epochs-left. The Contribute button is disabled until the vault_dao module ships.
|
|
4
4
|
import { computed } from 'vue'
|
|
5
|
+
import { UiPanel, UiBadge, UiToolbarButton } from '@meddleware/ui'
|
|
5
6
|
import type { Proposal } from '../composables/useProposals.js'
|
|
6
7
|
|
|
7
8
|
const props = defineProps<{
|
|
@@ -19,10 +20,10 @@ const epochsLeft = computed(() => {
|
|
|
19
20
|
return props.proposal.endEpoch - props.currentEpoch
|
|
20
21
|
})
|
|
21
22
|
|
|
22
|
-
const
|
|
23
|
-
if (props.proposal.status === 'active') return '
|
|
24
|
-
if (props.proposal.status === 'pending') return '
|
|
25
|
-
return '
|
|
23
|
+
const badgeVariant = computed<'active' | 'pending' | 'closed'>(() => {
|
|
24
|
+
if (props.proposal.status === 'active') return 'active'
|
|
25
|
+
if (props.proposal.status === 'pending') return 'pending'
|
|
26
|
+
return 'closed'
|
|
26
27
|
})
|
|
27
28
|
|
|
28
29
|
function formatSui(mist: bigint): string {
|
|
@@ -32,39 +33,65 @@ function formatSui(mist: bigint): string {
|
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
35
|
<template>
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<template v-else-if="epochsLeft !== null && epochsLeft <= 0">Expired</template>
|
|
45
|
-
</span>
|
|
46
|
-
</div>
|
|
36
|
+
<UiPanel class="proposal">
|
|
37
|
+
<header class="proposal__head">
|
|
38
|
+
<UiBadge :variant="badgeVariant">{{ proposal.status }}</UiBadge>
|
|
39
|
+
<h3 class="proposal__title">{{ proposal.title }}</h3>
|
|
40
|
+
<small class="proposal__epochs">
|
|
41
|
+
<template v-if="epochsLeft !== null && epochsLeft > 0">{{ epochsLeft }} epochs left</template>
|
|
42
|
+
<template v-else-if="epochsLeft !== null && epochsLeft <= 0">Expired</template>
|
|
43
|
+
</small>
|
|
44
|
+
</header>
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
<p class="dao-muted proposal__desc">{{ proposal.description }}</p>
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<span>{{ formatSui(proposal.contributedMist) }} SUI raised</span>
|
|
56
|
-
<span>{{ pct }}% of {{ formatSui(proposal.targetMist) }} SUI target</span>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
48
|
+
<progress class="dao-progress" :value="pct" max="100" aria-label="Funding progress">{{ pct }}%</progress>
|
|
49
|
+
<p class="proposal__totals">
|
|
50
|
+
<span>{{ formatSui(proposal.contributedMist) }} SUI raised</span>
|
|
51
|
+
<span>{{ pct }}% of {{ formatSui(proposal.targetMist) }} SUI target</span>
|
|
52
|
+
</p>
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
style="margin-top: 6px; opacity: 0.5; cursor: not-allowed"
|
|
65
|
-
>
|
|
66
|
-
Contribute
|
|
67
|
-
</button>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
54
|
+
<UiToolbarButton disabled title="Vault DAO governance module launching soon" class="proposal__contribute">
|
|
55
|
+
Contribute
|
|
56
|
+
</UiToolbarButton>
|
|
57
|
+
</UiPanel>
|
|
70
58
|
</template>
|
|
59
|
+
|
|
60
|
+
<style scoped>
|
|
61
|
+
.proposal {
|
|
62
|
+
margin-bottom: 8px;
|
|
63
|
+
}
|
|
64
|
+
.proposal__head {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: flex-start;
|
|
67
|
+
gap: 6px;
|
|
68
|
+
margin-bottom: 6px;
|
|
69
|
+
}
|
|
70
|
+
.proposal__title {
|
|
71
|
+
margin: 0;
|
|
72
|
+
font-size: 0.85rem;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
}
|
|
75
|
+
.proposal__epochs {
|
|
76
|
+
margin-inline-start: auto;
|
|
77
|
+
padding-inline-start: 8px;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
font-family: var(--mw-font-mono);
|
|
80
|
+
font-size: 0.75rem;
|
|
81
|
+
color: var(--muted);
|
|
82
|
+
}
|
|
83
|
+
.proposal__desc {
|
|
84
|
+
margin: 0 0 8px;
|
|
85
|
+
}
|
|
86
|
+
.proposal__totals {
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
margin: 2px 0 4px;
|
|
90
|
+
font-size: 0.72rem;
|
|
91
|
+
color: var(--muted);
|
|
92
|
+
font-family: var(--mw-font-mono);
|
|
93
|
+
}
|
|
94
|
+
.proposal__contribute {
|
|
95
|
+
margin-top: 6px;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, onMounted } from 'vue'
|
|
1
|
+
import { ref, onMounted, getCurrentInstance } from 'vue'
|
|
2
2
|
import { getSuiClient } from '../wallet.js'
|
|
3
3
|
import { PACKAGE_ID } from '../config.js'
|
|
4
4
|
|
|
@@ -68,7 +68,8 @@ export function useDaoEvents(limit = 20) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// Auto-load on mount, but only when used inside a component (skips in unit tests).
|
|
72
|
+
if (getCurrentInstance()) onMounted(load)
|
|
72
73
|
|
|
73
74
|
return { events, loading, error, lastRefresh, reload: load }
|
|
74
75
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, onMounted } from 'vue'
|
|
1
|
+
import { ref, onMounted, getCurrentInstance } from 'vue'
|
|
2
2
|
import { getSuiClient } from '../wallet.js'
|
|
3
3
|
|
|
4
4
|
export function useEpoch() {
|
|
@@ -14,7 +14,8 @@ export function useEpoch() {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// Auto-load on mount, but only when used inside a component (skips in unit tests).
|
|
18
|
+
if (getCurrentInstance()) onMounted(load)
|
|
18
19
|
|
|
19
20
|
return { epoch, reload: load }
|
|
20
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, onMounted } from 'vue'
|
|
1
|
+
import { ref, onMounted, getCurrentInstance } from 'vue'
|
|
2
2
|
import { getSuiClient } from '../wallet.js'
|
|
3
3
|
import { PACKAGE_ID, CONFIG_ID } from '../config.js'
|
|
4
4
|
|
|
@@ -42,7 +42,7 @@ export function useGates() {
|
|
|
42
42
|
|
|
43
43
|
// Fetch each Gate shared object referenced by the AdminCap's gate_id.
|
|
44
44
|
const gateList = await Promise.all(
|
|
45
|
-
(objects ?? []).map(async (o:
|
|
45
|
+
(objects ?? []).map(async (o: { json?: { gate_id?: unknown } | null; object?: { json?: { gate_id?: unknown } | null } | null }): Promise<Gate | null> => {
|
|
46
46
|
const capFields = o?.json ?? o?.object?.json
|
|
47
47
|
const gateId = String(capFields?.gate_id ?? '')
|
|
48
48
|
if (!gateId || gateId === 'undefined') return null
|
|
@@ -70,7 +70,8 @@ export function useGates() {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
// Auto-load on mount, but only when used inside a component (skips in unit tests).
|
|
74
|
+
if (getCurrentInstance()) onMounted(load)
|
|
74
75
|
|
|
75
76
|
return { gates, loading, error, reload: load }
|
|
76
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Reads the PlatformConfig shared object once on mount and exposes the treasury
|
|
2
2
|
// address + commission rate (bps). Source of truth for the commission model and for
|
|
3
3
|
// whose AdminCaps the gate discovery (useGates) looks up.
|
|
4
|
-
import { ref, onMounted } from 'vue'
|
|
4
|
+
import { ref, onMounted, getCurrentInstance } from 'vue'
|
|
5
5
|
import { getSuiClient } from '../wallet.js'
|
|
6
6
|
import { CONFIG_ID } from '../config.js'
|
|
7
7
|
|
|
@@ -35,7 +35,8 @@ export function usePlatformConfig() {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// Auto-load on mount, but only when used inside a component (skips in unit tests).
|
|
39
|
+
if (getCurrentInstance()) onMounted(load)
|
|
39
40
|
|
|
40
41
|
return { config, loading, error, reload: load }
|
|
41
42
|
}
|