Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
For registered content, do not register again
Browse files Browse the repository at this point in the history
  • Loading branch information
kikakkz committed Dec 6, 2023
1 parent b08d644 commit 59453e6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 21 deletions.
29 changes: 29 additions & 0 deletions TestData.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ https://ipfs.moralis.io:2053/ipfs/QmVpwaCqLut3wqwB5KSQr2fGnbLuJt5e3LhNvzvcisewZB
https://ipfs.moralis.io:2053/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm

Activity

The Best Novel of the Month
Find the best author of the world, and support them!
https://ipfs.moralis.io:2053/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm
https://www.baidu.com

https://ipfs.moralis.io:2053/ipfs/QmbzbxQcdcUcdzqrtU1S7cFd7swmcBnytWv5rf1yw94g9s
https://ipfs.moralis.io:2053/ipfs/Qmdco6YbN7qK81tNbQw3RmnowSUXiEuaKjG6tt8FsChDuA
Expand All @@ -30,6 +32,33 @@ Best Month Novel
Better Month Novel
Good Month Novel

https://ipfs.moralis.io:2053/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm






The Best Novel of the Year
Find the best author of the world, and support them!
https://ipfs.moralis.io:2053/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm
https://www.baidu.com

https://ipfs.moralis.io:2053/ipfs/QmbzbxQcdcUcdzqrtU1S7cFd7swmcBnytWv5rf1yw94g9s
https://ipfs.moralis.io:2053/ipfs/Qmdco6YbN7qK81tNbQw3RmnowSUXiEuaKjG6tt8FsChDuA
https://ipfs.moralis.io:2053/ipfs/QmTSfgqeKUNvNUqRfQSFTbPkjjFDtGZFxWQkhyqWwMHhAJ

Within the vote period, user can vote for their favorite novel listed in the candidates. The only criteria is how much you like the novel. The author of the winner novel will get 90% of the reward amount. Remainant part of the reward will be distributed to voter according to their vote power when they vote.

https://ipfs.moralis.io:2053/ipfs/QmTDxnzcvj2p3xBrKcGv1wxoyhAn2yzCQnZZ9LmFjReuH9
https://ipfs.moralis.io:2053/ipfs/QmbvZ2hbF3nEq5r3ijMEiSGssAmJvtyFwiejTAGHv74LR5
https://ipfs.moralis.io:2053/ipfs/QmVpwaCqLut3wqwB5KSQr2fGnbLuJt5e3LhNvzvcisewZB

Best Year Novel
Better Year Novel
Good Year Novel

https://ipfs.moralis.io:2053/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm



42 changes: 23 additions & 19 deletions webui/src/components/ActivityRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@
</div>
<div v-else>
<div v-if='contents.length'>
<div v-for='(_content, i) in contents' :key='_content.cid' :style='{borderBottom:i < contents.length - 1 ? "1px solid grey" : ""}'>
<div
v-for='(_content, i) in contents'
:key='_content.cid'
:style='{borderBottom:i < contents.length - 1 ? "1px solid grey" : "",marginBottom:"32px"}'
>
<div :style='{paddingBottom: "48px"}'>
<div class='row'>
<div
class='cursor-pointer'
:style='{fontWeight: "bold", fontSize: "26px", wordBreak: "break-word", marginBottom: "4px"}'
@click='onTitleClick(_content.cid)'
>
{{ _content.title?.length ? _content.title : 'You should have a title!' }}
</div>
<q-btn
flat
dense
label='Register'
class='text-blue-6'
:style='{marginLeft:"16px"}'
@click='onRegisterClick(_content.cid)'
:disable='objectRegistered(_content.cid)'
/>
<div
class='cursor-pointer'
:style='{fontWeight: "bold", fontSize: "26px", wordBreak: "break-word", marginBottom: "4px"}'
@click='onTitleClick(_content.cid)'
>
{{ _content.title?.length ? _content.title : 'You should have a title!' }}
</div>
<div :style='{marginBottom: "12px"}' class='text-grey-8'>
{{ date.formatDate(_content.createdAt / 1000, 'YYYY-MM-DD HH:mm') }}
</div>
<div :style='{wordBreak:"break-word"}'>
{{ _content.content }}
</div>
<div>{{ _content.cid }} - {{ activityId }} - {{ objectRegistered(_content.cid) }}</div>
<q-btn
flat
dense
class='text-blue-6'
:style='{marginTop:"16px"}'
@click='onRegisterClick(_content.cid)'
:disable='objectRegistered(_content.cid)'
>
REGISTER TO <span class='text-green-8' :style='{marginLeft:"8px",fontSize:"12px"}'>{{ _activity?.title }}</span>
</q-btn>
</div>
</div>
</div>
Expand Down Expand Up @@ -83,7 +87,7 @@ const onTitleClick = (cid: string) => {
}

const objectRegistered = (cid: string) => {
return activity.objectRegistered(activityId.value, cid)
return activity.objectRegistered(Number(activityId.value), cid)
}

const onRegisterClick = async (cid: string) => {
Expand Down
4 changes: 2 additions & 2 deletions webui/src/stores/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ export const useActivityStore = defineStore('activity', {
return joinType
}
},
objectRegistered (): (id: number, objectId: string) => boolean {
objectRegistered (): (id: number, objectId: string) => boolean | undefined {
return (id: number, objectId: string) => {
return this.activities.get(id)?.objectCandidates.get(objectId) || false
return Object.keys(this.activities.get(id)?.objectCandidates || new Map<string, boolean>()).includes(objectId)
}
}
},
Expand Down

0 comments on commit 59453e6

Please sign in to comment.