@meddleware/dao-ui 0.1.0
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/index.html +13 -0
- package/package.json +60 -0
- package/src/App.vue +51 -0
- package/src/DaoView.vue +64 -0
- package/src/components/AmountCell.vue +21 -0
- package/src/components/DataTable.vue +24 -0
- package/src/components/Panel.vue +12 -0
- package/src/components/ProposalRow.vue +68 -0
- package/src/components/StatusBar.vue +34 -0
- package/src/components/TabBar.vue +30 -0
- package/src/composables/useDaoEvents.ts +70 -0
- package/src/composables/useEpoch.ts +20 -0
- package/src/composables/useGates.ts +53 -0
- package/src/composables/usePlatformConfig.ts +38 -0
- package/src/composables/useProposals.ts +57 -0
- package/src/composables/useTreasury.ts +30 -0
- package/src/config.ts +28 -0
- package/src/env.d.ts +15 -0
- package/src/index.ts +1 -0
- package/src/main.ts +7 -0
- package/src/styles/qt.css +356 -0
- package/src/tabs/GovernanceTab.vue +54 -0
- package/src/tabs/HistoryTab.vue +70 -0
- package/src/tabs/OverviewTab.vue +88 -0
- package/src/tabs/ProposalsTab.vue +25 -0
- package/src/tabs/TreasuryTab.vue +78 -0
- package/src/wallet.ts +25 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +6 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import Panel from '../components/Panel.vue'
|
|
4
|
+
import AmountCell from '../components/AmountCell.vue'
|
|
5
|
+
import DataTable from '../components/DataTable.vue'
|
|
6
|
+
import { usePlatformConfig } from '../composables/usePlatformConfig.js'
|
|
7
|
+
import { useTreasury } from '../composables/useTreasury.js'
|
|
8
|
+
import { useGates } from '../composables/useGates.js'
|
|
9
|
+
|
|
10
|
+
const { config, loading: cfgLoading, error: cfgErr } = usePlatformConfig()
|
|
11
|
+
const { balance } = useTreasury(() => config.value?.treasury ?? null)
|
|
12
|
+
const { gates, loading: gatesLoading } = useGates()
|
|
13
|
+
|
|
14
|
+
const commissionPct = computed(() =>
|
|
15
|
+
config.value ? (config.value.commissionBps / 100).toFixed(2) + '%' : '—',
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
function formatPrice(mist: bigint): string {
|
|
19
|
+
const n = Number(mist) / 1e9
|
|
20
|
+
return n >= 0.0001 ? n.toFixed(4) + ' SUI' : n.toFixed(9).replace(/0+$/, '') + ' SUI'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function shortDate(ms: number): string {
|
|
24
|
+
return ms ? new Date(ms).toISOString().slice(0, 10) : '—'
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div style="display: flex; flex-direction: column; gap: 10px">
|
|
30
|
+
<Panel title="Commission Configuration">
|
|
31
|
+
<p v-if="cfgLoading" class="dao-muted">Loading…</p>
|
|
32
|
+
<p v-else-if="cfgErr" class="dao-muted">{{ cfgErr }}</p>
|
|
33
|
+
<template v-else-if="config">
|
|
34
|
+
<div class="dao-stat-grid" style="max-width: 480px">
|
|
35
|
+
<span class="dao-stat-grid__label">Commission rate</span>
|
|
36
|
+
<span class="dao-stat-grid__value dao-mono">{{ commissionPct }} ({{ config.commissionBps }} bps)</span>
|
|
37
|
+
|
|
38
|
+
<span class="dao-stat-grid__label">Treasury address</span>
|
|
39
|
+
<span class="dao-stat-grid__value dao-mono" style="font-size: 0.72rem; text-align: left; word-break: break-all">
|
|
40
|
+
{{ config.treasury }}
|
|
41
|
+
</span>
|
|
42
|
+
|
|
43
|
+
<span class="dao-stat-grid__label">Current balance</span>
|
|
44
|
+
<AmountCell class="dao-stat-grid__value" :mist="balance" />
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
<p v-else class="dao-muted">PlatformConfig not loaded.</p>
|
|
48
|
+
</Panel>
|
|
49
|
+
|
|
50
|
+
<Panel title="Fee Distribution">
|
|
51
|
+
<p class="dao-muted" style="margin: 0; font-size: 0.78rem">
|
|
52
|
+
Fee distributor data (buyback/burn ratios, distribution history) will appear here when
|
|
53
|
+
<code>vault_fee_distributor</code> is deployed.
|
|
54
|
+
</p>
|
|
55
|
+
</Panel>
|
|
56
|
+
|
|
57
|
+
<Panel title="Community Gates">
|
|
58
|
+
<p v-if="gatesLoading" class="dao-muted">Loading gates…</p>
|
|
59
|
+
<DataTable v-else-if="gates.length" :empty="'No gates found'">
|
|
60
|
+
<template #head>
|
|
61
|
+
<th>Gate name</th>
|
|
62
|
+
<th>Price</th>
|
|
63
|
+
<th>Created</th>
|
|
64
|
+
<th>Object ID</th>
|
|
65
|
+
</template>
|
|
66
|
+
<tr v-for="gate in gates" :key="gate.id">
|
|
67
|
+
<td>{{ gate.name }}</td>
|
|
68
|
+
<td class="dao-amount">{{ formatPrice(gate.price) }}</td>
|
|
69
|
+
<td class="dao-mono" style="font-size: 0.72rem">{{ shortDate(gate.timestampMs) }}</td>
|
|
70
|
+
<td class="dao-mono" style="font-size: 0.7rem">
|
|
71
|
+
{{ gate.id.slice(0, 10) }}…{{ gate.id.slice(-6) }}
|
|
72
|
+
</td>
|
|
73
|
+
</tr>
|
|
74
|
+
</DataTable>
|
|
75
|
+
<p v-else class="dao-placeholder">No gates found.</p>
|
|
76
|
+
</Panel>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
package/src/wallet.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Thin dao-ui shim over the shared @meddleware/wallet-adapter singleton.
|
|
2
|
+
// Wallet is used for signing only (DAO actions when vault_dao ships). All chain reads are done
|
|
3
|
+
// via a bare SuiClient so no wallet connection is required to view treasury/proposals/history.
|
|
4
|
+
import {
|
|
5
|
+
useWallet as useWalletBase,
|
|
6
|
+
getSuiClient as getSuiClientBase,
|
|
7
|
+
useNetwork,
|
|
8
|
+
} from '@meddleware/wallet-adapter'
|
|
9
|
+
|
|
10
|
+
const { network, rpcUrl } = useNetwork()
|
|
11
|
+
|
|
12
|
+
export function getSuiClient() {
|
|
13
|
+
return getSuiClientBase(network.value, rpcUrl.value)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useWallet() {
|
|
17
|
+
const base = useWalletBase({ requiredFeatures: ['sui:signPersonalMessage'] })
|
|
18
|
+
return {
|
|
19
|
+
account: base.account,
|
|
20
|
+
connecting: base.connecting,
|
|
21
|
+
connect: base.connect,
|
|
22
|
+
disconnect: base.disconnect,
|
|
23
|
+
getSuiClient,
|
|
24
|
+
}
|
|
25
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
"noEmit": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.d.ts", "vite.config.ts"]
|
|
18
|
+
}
|