-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from holonauts/feat/list-applications
Feat/list applications
- Loading branch information
Showing
7 changed files
with
99 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 23 additions & 1 deletion
24
ui/src/routes/grant-pools/[actionHashB64]/applications/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
VIEW ALL APPLICATIONS FOR GRANT POOL | ||
<script lang="ts"> | ||
import ApplicationListItem from './ApplicationListItem.svelte'; | ||
import RecordList from '$lib/components/RecordList.svelte'; | ||
import { decodeHashFromBase64 } from '@holochain/client'; | ||
import { page } from '$app/stores'; | ||
$: actionHash = decodeHashFromBase64($page.params.actionHashB64); | ||
</script> | ||
|
||
<RecordList | ||
entryType="Application" | ||
callZomeRequest={{ | ||
cap_secret: null, | ||
role_name: 'grant_pools', | ||
zome_name: 'grants', | ||
fn_name: 'get_applications_for_grant_pool', | ||
payload: actionHash | ||
}} | ||
> | ||
<svelte:fragment let:hash> | ||
<ApplicationListItem applicationHash={hash} /> | ||
</svelte:fragment> | ||
</RecordList> |
54 changes: 54 additions & 0 deletions
54
ui/src/routes/grant-pools/[actionHashB64]/applications/ApplicationListItem.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script lang="ts"> | ||
import { encodeHashToBase64, type ActionHash } from '@holochain/client'; | ||
import RecordListItem from '$lib/components/RecordDetail.svelte'; | ||
import BaseLabelContent from '$lib/components/BaseLabelContent.svelte'; | ||
import { Card } from 'flowbite-svelte'; | ||
import { goto } from '$app/navigation'; | ||
import { ACCEPTED_TOKEN_DECIMALS, ACCEPTED_TOKEN_SYMBOL } from '$lib/config'; | ||
import BaseBadgeRecordTimestamp from '$lib/components/BaseBadgeRecordTimestamp.svelte'; | ||
import { formatUnits } from 'viem'; | ||
import { u256ToBigint } from '$lib/utils/u256'; | ||
import ProfileInline from '$lib/components/ProfileInline.svelte'; | ||
import BaseStatusBadge from '$lib/components/BaseStatusBadge.svelte'; | ||
import { page } from '$app/stores'; | ||
export let applicationHash: ActionHash; | ||
</script> | ||
|
||
<RecordListItem | ||
callZomeRequest={{ | ||
cap_secret: null, | ||
role_name: 'grant_pools', | ||
zome_name: 'grants', | ||
fn_name: 'get_latest_application', | ||
payload: applicationHash | ||
}} | ||
> | ||
<svelte:fragment let:record let:entry> | ||
<Card | ||
size="xl" | ||
on:click={() => | ||
goto( | ||
`/grant-pools/${$page.params.actionHashB64}/applications/${encodeHashToBase64(applicationHash)}` | ||
)} | ||
> | ||
<div class="flex items-start justify-between"> | ||
<ProfileInline agentPubKey={record.signed_action.hashed.content.author} /> | ||
|
||
<div class="flex flex-col items-end justify-start"> | ||
<div> | ||
<BaseStatusBadge status={entry.status} /> | ||
</div> | ||
<div> | ||
<BaseBadgeRecordTimestamp {record} /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<BaseLabelContent label="Requested Amount"> | ||
{formatUnits(u256ToBigint(entry.amount), ACCEPTED_TOKEN_DECIMALS)} | ||
{ACCEPTED_TOKEN_SYMBOL} | ||
</BaseLabelContent> | ||
</Card> | ||
</svelte:fragment> | ||
</RecordListItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters