Skip to content

Commit

Permalink
various fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tempe-techie committed Oct 1, 2024
1 parent 16de854 commit 1417fdd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
17 changes: 14 additions & 3 deletions components/profile/PunkProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div>
<div class="card border">
<div class="card-body">
<p class="fs-3" @click="$router.back()">
<i class="bi bi-arrow-left-circle cursor-pointer"></i>
<p class="fs-3">
<i class="bi bi-arrow-left-circle cursor-pointer" @click="$router.back()"></i>
</p>

<div class="row">
Expand Down Expand Up @@ -36,6 +36,11 @@
{{ balanceChatToken }} {{ $config.chatTokenSymbol }}
</p>

<p class="me-4" v-if="$config.activityPointsAddress && $config.showFeatures.activityPoints">
<i class="bi bi-wallet me-1"></i>
{{ balanceAp }} AP
</p>

<p class="me-4">
<i class="bi bi-box-arrow-up-right me-2"></i>
<a
Expand Down Expand Up @@ -147,6 +152,7 @@ import { useUserStore } from '~/store/user'
import { useToast } from 'vue-toastification/dist/index.mjs'
import ChangePfpModal from '~/components/profile/ChangePfpModal.vue'
import ProfileImage from '~/components/profile/ProfileImage.vue'
import { getActivityPoints } from '~/utils/balanceUtils'
import { getDomainName, getDomainHolder } from '~/utils/domainUtils'
import { fetchUsername, storeData, storeUsername } from '~/utils/storageUtils'
import { getTextWithoutBlankCharacters } from '~/utils/textUtils'
Expand All @@ -157,6 +163,7 @@ export default {
data() {
return {
balanceAp: 0,
balanceChatTokenWei: 0,
domain: this.pDomain,
newEmail: null,
Expand All @@ -165,7 +172,6 @@ export default {
uBalance: 0,
waitingDataLoad: false,
waitingImageUpdate: false,
waitingSetEmail: false,
}
},
Expand Down Expand Up @@ -290,6 +296,11 @@ export default {
this.balanceChatTokenWei = await chatTokenContract.balanceOf(this.uAddress)
}
// fetch activity points balance
if (this.$config.activityPointsAddress && this.$config.showFeatures.activityPoints) {
this.balanceAp = await getActivityPoints(this.uAddress, provider);
}
}
},
Expand Down
14 changes: 12 additions & 2 deletions components/sidebars/SidebarLeft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="sidebar-nav list-group border-0 rounded-0 text-sm-start min-vh-100">
<div class="card m-2 p-2 bg-light">
<div v-if="isActivated && userStore.getDefaultDomain" class="text-center">
<NuxtLink to="/profile">
<NuxtLink :to="getProfileLink">
<ProfileImage
:key="userStore.getImage"
@click="closeLeftSidebar"
Expand Down Expand Up @@ -101,7 +101,7 @@
class="nav-link"
:class="$route.path.startsWith('/profile') ? 'active' : ''"
aria-current="page"
to="/profile"
:to="getProfileLink"
>
<i class="bi bi-person me-2"></i> Profile
</NuxtLink>
Expand Down Expand Up @@ -282,6 +282,16 @@ export default {
},
computed: {
getProfileLink() {
if (this.userStore.getDefaultDomain) {
return `/profile/?id=${this.userStore.getDefaultDomain}`;
} else if (this.address) {
return `/profile/?id=${this.address}`;
} else {
return `/profile`;
}
},
getUserAp() {
if (this.userStore.getCurentUserActivityPoints > 0) {
return this.userStore.getCurentUserActivityPoints
Expand Down
2 changes: 1 addition & 1 deletion pages/nft/collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
:audioUrl="audioUrl" :videoUrl="videoUrl" :youtubeUrl="youtubeUrl"
/>

<!-- Chat feed - TODO:replace with Comments component -->
<!-- Chat feed -->
<ChatFeed
:hideCommentBox="false"
class="mt-3 scroll-500"
Expand Down
18 changes: 0 additions & 18 deletions store/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export const useUserStore = defineStore({
address: null,
chatTokenBalanceWei: BigInt(0),
defaultDomain: null,
did: null,
didParent: null,
followers: 0,
following: 0,
lastActivityTimestamp: null,
Expand Down Expand Up @@ -46,14 +44,6 @@ export const useUserStore = defineStore({
return state.defaultDomain
},

getDid(state) {
return state.did
},

getDidParent(state) {
return state.didParent
},

getFollowers(state) {
return state.followers
},
Expand Down Expand Up @@ -108,14 +98,6 @@ export const useUserStore = defineStore({
this.defaultDomain = domain
},

setDid(did: any) {
this.did = did
},

setDidParent(didParent: any) {
this.didParent = didParent
},

setFollowers(followers: any) {
this.followers = followers
},
Expand Down
2 changes: 1 addition & 1 deletion utils/balanceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function getActivityPoints(userAddress, signer) {
if (activityPoints < 1) {
activityPoints = activityPoints.toFixed(2)
} else {
activityPoints = Math.round(activityPoints)
activityPoints = Number.parseFloat(activityPoints)
}

return activityPoints
Expand Down
6 changes: 2 additions & 4 deletions utils/ipfsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getIpfsUrl(url) {
} else if (url.startsWith("https://ipfs.filebase.io/ipfs/")) {
cid = url.replace("https://ipfs.filebase.io/ipfs/", "");
} else if (url.includes("pinata.cloud/ipfs/")) {
cid = url.split(".pinata.cloud/ipfs/")[1];
cid = url.split("pinata.cloud/ipfs/")[1];
cid = cid.replace("http://", "");
cid = cid.replace("https://", "");
} else if (url.includes(".ipfs.sphn.link/")) {
Expand All @@ -41,7 +41,7 @@ export function getIpfsUrl(url) {
}

export async function getWorkingUrl(url) {
const config = useRuntimeConfig()
const config = useRuntimeConfig();
let ipfsUrl = url

if (url.startsWith("http")) {
Expand All @@ -67,8 +67,6 @@ export async function getWorkingUrl(url) {
'https://ipfs.filebase.io/ipfs/',
//'https://cloudflare-ipfs.com/ipfs/',
'https://gateway.pinata.cloud/ipfs/',
'https://ipfs.itslit.org/ipfs/',
'https://ipfs.dylmusic.com/ipfs/',
]

if (ipfsUrl.startsWith("ipfs://")) {
Expand Down

0 comments on commit 1417fdd

Please sign in to comment.