Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying KYC on farmers #3763

Merged
merged 4 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
63 changes: 59 additions & 4 deletions packages/playground/src/dashboard/farms_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,80 @@
<v-icon size="30" class="pr-3">mdi-silo</v-icon>
<v-card-title class="pa-0">Farms</v-card-title>
</v-card>
<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 verification process to proceed.
</div>
</div>
</VAlert>
<div class="d-flex justify-content-center align-items-center mt-10" 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>
<div class="d-flex justify-center align-center" style="height: 100vh">
<VBtn color="primary">Click Me</VBtn>
</div>
</template>

<CreateFarm class="mt-4" @farm-created="handleFarmCreated" />
<UserFarms :ref="el => (userFarms = el)" :reloadFarms="farmsReload" />
<UserNodes />
<div class="d-flex justify-content-center align-items-center mb-10">
<v-btn
class="d-inline-block mx-auto"
text="Verify now"
size="small"
color="error"
@click="kycDialog = true"
:loading="kycDialogLoading"
/>
</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);

const showKYCError = computed(() => kyc.status !== KycStatus.verified);
function handleFarmCreated() {
farmsReload.value = !farmsReload.value;
}
Expand All @@ -37,9 +88,13 @@ export default {
},
);
return {
baseURL,
farmsReload,
handleFarmCreated,
userFarms,
showKYCError,
kycDialog,
kycDialogLoading,
};
},
};
Expand Down
Loading