Skip to content

Commit

Permalink
Applying KYC on farmers
Browse files Browse the repository at this point in the history
  • Loading branch information
maayarosama committed Dec 19, 2024
1 parent a221df8 commit bc2de10
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
Binary file added packages/playground/public/images/kyc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 44 additions & 5 deletions packages/playground/src/dashboard/farms_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,64 @@
<v-icon size="30" class="pr-3">mdi-silo</v-icon>
<v-card-title class="pa-0">Farms</v-card-title>
</v-card>

<CreateFarm class="mt-4" @farm-created="handleFarmCreated" />
<UserFarms :ref="el => (userFarms = el)" :reloadFarms="farmsReload" />
<UserNodes />
<template v-if="showKYCError">
<VAlert variant="tonal" type="error" class="mt-4">
<template #prepend>
<v-icon icon="mdi-shield-remove"></v-icon>
</template>
<div class="d-flex justify-space-between align-baseline">
<div>To start farming, KYC verification is required. Please complete the process to proceed.</div>
<v-btn text="Verify now" size="small" color="error" @click="kycDialog = true" :loading="kycDialogLoading" />
</div>
</VAlert>
<div class="d-flex justify-content-center align-items-center" style="height: 100%; width: 100%">
<v-img class="d-inline-block mx-auto" :src="baseURL + 'images/kyc.png'" style="max-width: 40%"></v-img>
</div>
</template>
<template v-else>
<CreateFarm class="mt-4" @farm-created="handleFarmCreated" />
<UserFarms :ref="el => (userFarms = el)" :reloadFarms="farmsReload" />
<UserNodes />
</template>
</div>
<KycVerifier
v-if="kycDialog"
:loading="kycDialogLoading"
@update:loading="kycDialogLoading = $event"
:moduleValue="kycDialog"
@update:moduleValue="kycDialog = $event"
/>
</template>

<script lang="ts">
import { ref, watch } from "vue";
import { KycStatus } from "@threefold/grid_client";
import { computed, ref, watch } from "vue";
import KycVerifier from "@/components/KycVerifier.vue";
import { useKYC } from "@/stores/kyc";
import CreateFarm from "./components/create_farm.vue";
import UserFarms from "./components/user_farms.vue";
import UserNodes from "./components/user_nodes.vue";
export default {
name: "DashboardFarms",
components: {
KycVerifier,
UserNodes,
UserFarms,
CreateFarm,
},
setup() {
const baseURL = import.meta.env.BASE_URL;
const farmsReload = ref<boolean>(false);
const userFarms = ref();
const kyc = useKYC();
const kycDialog = ref(false);
const kycDialogLoading = ref(false);
console.log("kyc", kyc);
const showKYCError = computed(() => kyc.status !== KycStatus.verified);
function handleFarmCreated() {
farmsReload.value = !farmsReload.value;
}
Expand All @@ -37,9 +72,13 @@ export default {
},
);
return {
baseURL,
farmsReload,
handleFarmCreated,
userFarms,
showKYCError,
kycDialog,
kycDialogLoading,
};
},
};
Expand Down

0 comments on commit bc2de10

Please sign in to comment.