Skip to content

Group all toggles in one component #4161

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

Open
wants to merge 24 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3f7cce2
Group all toggles in one component
samaradel May 21, 2025
fa4f269
- Fix type check
samaradel May 21, 2025
760518e
Set default values for props
samaradel May 21, 2025
6204356
Verify passed value type
samaradel May 21, 2025
41d3b58
Avoid inline assignments
samaradel May 21, 2025
f611dfe
Handle null values
samaradel May 21, 2025
2d45b5f
Removed the onUpdated functions
samaradel May 22, 2025
14684ef
Fix types
samaradel May 22, 2025
e5d8373
Get the old changes back
samaradel May 22, 2025
8aa1d50
Move rental switchs component inside selection details component
samaradel May 28, 2025
6080d4b
Merge branch 'development' into dev_toggles_component
samaradel May 28, 2025
33a4aff
Remove the default true value
samaradel Jun 1, 2025
4364f4f
Merge branch 'development' into dev_toggles_component
samaradel Jun 3, 2025
5e9df5d
Remove static showGPU prop
samaradel Jun 3, 2025
7088c08
Fix conflicts
samaradel Jun 4, 2025
0b0a8fc
Fix eslint config file
samaradel Jun 4, 2025
286647e
Merge branch 'development' into dev_toggles_component
samaradel Jun 12, 2025
599346c
lint fix
samaradel Jun 12, 2025
6148f14
Merge branch 'development' into dev_toggles_component
samaradel Jun 12, 2025
29dace4
Remove unrelated changes
samaradel Jun 18, 2025
1b40ce9
Merge branch 'development' into dev_toggles_component
samaradel Jun 18, 2025
236c0f2
Update eslint.config.js
samaradel Jun 18, 2025
2673096
Revert unwanted changes
samaradel Jun 22, 2025
770abe7
Removed the unnecessary handler functions
samaradel Jul 10, 2025
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
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ export default [
},
},
...vueConfig,
];
];
14 changes: 4 additions & 10 deletions packages/playground/src/components/KycVerifier.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@
<v-card>
<v-card-title class="bg-primary d-flex align-center">
<v-icon icon="mdi-security" />
<div class="pl-2">
Terms & Conditions
</div>
<div class="pl-2">Terms & Conditions</div>
</v-card-title>

<v-card-text class="pb-0">
We use iDenfy to verify your identity.
<br>
<br />
Please ensure you review iDenfy’s <span class="font-weight-bold">Security and Compliance</span>, which
includes their <span class="font-weight-bold">Terms & Conditions, Privacy Policy</span>, and other relevant
documents.
Expand All @@ -46,12 +44,8 @@
</v-checkbox>
</v-card-text>
<v-card-actions class="justify-end my-1 mr-2">
<v-btn color="anchor" @click="handleAgreementDialog(false)">
Cancel
</v-btn>
<v-btn :disabled="!agreedCheckbox" @click="handleAgreementDialog(true)">
Continue
</v-btn>
<v-btn color="anchor" @click="handleAgreementDialog(false)"> Cancel </v-btn>
<v-btn :disabled="!agreedCheckbox" @click="handleAgreementDialog(true)"> Continue </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down
4 changes: 1 addition & 3 deletions packages/playground/src/components/TfOfflineNotifier.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
</VCardText>

<VCardActions v-if="failed" class="d-flex justify-center mb-4">
<VBtn prepend-icon="mdi-reload" variant="outlined" color="secondary" @click="reload">
Reload Now
</VBtn>
<VBtn prepend-icon="mdi-reload" variant="outlined" color="secondary" @click="reload"> Reload Now </VBtn>
</VCardActions>
</VCard>
</VDialog>
Expand Down
4 changes: 1 addition & 3 deletions packages/playground/src/components/app_info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@

<v-divider class="mb-2" />
<v-card-actions class="d-flex justify-end">
<v-btn color="anchor" class="mr-2 my-1" @click="setOpenInfo(false)">
Close
</v-btn>
<v-btn color="anchor" class="mr-2 my-1" @click="setOpenInfo(false)"> Close </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down
15 changes: 4 additions & 11 deletions packages/playground/src/components/caprover_worker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,12 @@
required
:ipv4="$props.modelValue.ipv4"
/>
<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="$props.modelValue.rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="$props.modelValue.dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>
<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="$props.modelValue.certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="$props.modelValue.selectionDetails"
v-model:rented-by-me="$props.modelValue.rentedByMe"
v-model:dedicated="$props.modelValue.dedicated"
v-model:certified="$props.modelValue.certified"
:selected-machines="selectedMachines"
:nodes-lock="nodesLock"
:filters="{
Expand Down Expand Up @@ -70,7 +64,6 @@ import { computed, type PropType } from "vue";

import { useGrid } from "@/stores";
import type { SelectedMachine } from "@/types/nodeSelector";
import { manual } from "@/utils/manual";

import Networks from "../components/networks.vue";
import type { CaproverWorker } from "../types";
Expand Down Expand Up @@ -142,7 +135,7 @@ export default {
}, [] as SelectedMachine[]);
});

return { rootFilesystemSize, manual, selectedMachines, rentedBy };
return { rootFilesystemSize, selectedMachines, rentedBy };
},
};
</script>
24 changes: 6 additions & 18 deletions packages/playground/src/components/connect_wallet_landing.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<template>
<div>
<v-alert color="warning" variant="tonal">
<v-icon size="24" class="pb-1">
mdi-alert-circle
</v-icon>
<v-icon size="24" class="pb-1"> mdi-alert-circle </v-icon>
Connect your TFChain
<a class="app-link" @click="$emit('openProfile')">Wallet</a>
to view {{ pageTitle }}
</v-alert>
<v-container class="custom-container">
<h4 class="text-center text-h5 text-lg-h4 my-4">
A Co-Owned Global Sovereign Internet
</h4>
<h4 class="text-center text-h5 text-lg-h4 my-4">A Co-Owned Global Sovereign Internet</h4>
<v-container class="d-flex justify-center">
<p class="home_text text-center text-subtitle w-75 sm-w-auto">
ThreeFold is
Expand All @@ -33,9 +29,7 @@
}"
>
<div class="d-flex justify-center mb-4">
<h4 class="text-center text-h5">
Live and Operational
</h4>
<h4 class="text-center text-h5">Live and Operational</h4>
</div>
<v-container fluid>
<div class="d-flex flex-column">
Expand All @@ -62,24 +56,18 @@
</div>
</v-container>
<div class="d-flex justify-center mt-5">
<v-btn variant="elevated" target="_blank" :href="statsUrl">
Explore ThreeFold Grid Capacity
</v-btn>
<v-btn variant="elevated" target="_blank" :href="statsUrl"> Explore ThreeFold Grid Capacity </v-btn>
</div>
</div>
<div class="text-center my-8">
<h4 class="text-h5 mb-4">
The <strong>Layer Zero</strong> for a Decentralized World
</h4>
<h4 class="text-h5 mb-4">The <strong>Layer Zero</strong> for a Decentralized World</h4>
<p class="home_text w-75 mx-auto text-subtitle-1">
Anything that runs on Linux can run on ThreeFold – with more security, more sustainably, and in true
decentralization. The ThreeFold Grid can support workloads from Blockchain to Web2 to Web3 to IoT and
Metaverse and more.
</p>
<div class="d-flex justify-center align-center flex-wrap my-4">
<v-btn variant="elevated" class="mr-2" target="_blank" :href="MANUAL_URL">
Learn about the grid
</v-btn>
<v-btn variant="elevated" class="mr-2" target="_blank" :href="MANUAL_URL"> Learn about the grid </v-btn>
</div>
</div>
</v-container>
Expand Down
16 changes: 4 additions & 12 deletions packages/playground/src/components/deposit_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
@update:model-value="closeDialog"
>
<v-card>
<VCardTitle class="bg-primary">
Deposit TFT
</VCardTitle>
<VCardTitle class="bg-primary"> Deposit TFT </VCardTitle>
<v-card-text>
<v-container>
<v-row class="py-2">
Expand All @@ -20,9 +18,7 @@
{{ selectedName ? selectedName.charAt(0).toUpperCase() + selectedName.slice(1) : "" }}
transaction.
</p>
<p class="mt-1 mb-8 text-secondary text-sm-subtitle-2 font-weight-bold">
Deposit fee is 1 TFT
</p>
<p class="mt-1 mb-8 text-secondary text-sm-subtitle-2 font-weight-bold">Deposit fee is 1 TFT</p>
</div>
<input-tooltip
v-if="selectedName == 'stellar'"
Expand Down Expand Up @@ -53,19 +49,15 @@
<v-col>
<QRPlayStore :qr="qrCodeText">
<b> OR </b>
<p class="mb-3">
Use ThreeFold Connect to scan this QRcode:
</p>
<p class="mb-3">Use ThreeFold Connect to scan this QRcode:</p>
</QRPlayStore>
</v-col>
</v-row>
</v-container>
<v-divider />
</v-card-text>
<v-card-actions class="justify-end my-1 mr-2">
<v-btn color="anchor" @click="closeDialog">
Close
</v-btn>
<v-btn color="anchor" @click="closeDialog"> Close </v-btn>
<v-btn color="secondary" :href="manual.tft_bridges" target="_blank" text="Learn more?" />
</v-card-actions>
</v-card>
Expand Down
10 changes: 3 additions & 7 deletions packages/playground/src/components/dynamic_tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:style="{
filter: `brightness(${!theme.global.current.value.dark ? 0.2 : 1})`,
}"
>
/>
{{ tab.title }}
<v-chip v-if="tab.workers && tab.workers > 0" color="info" class="ml-1">
{{ tab.workers }}
Expand All @@ -20,9 +20,7 @@
Validating
<v-progress-circular class="ml-1" indeterminate size="20" width="2" />
</v-chip>
<v-chip v-else-if="forms[tabs.indexOf(tab)]?.invalid" color="error" class="ml-1">
invalid
</v-chip>
<v-chip v-else-if="forms[tabs.indexOf(tab)]?.invalid" color="error" class="ml-1"> invalid </v-chip>
</v-tab>
</v-tabs>

Expand All @@ -38,9 +36,7 @@
:tabs="tabs"
/>
<slot v-else-if="$slots.default" :index="index" :tab="tab" :active-tab="activeTab" :tabs="tabs" />
<template v-else>
Please add content for this tab!
</template>
<template v-else> Please add content for this tab! </template>
</form-validator>
</template>
</v-tab-item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<template>
<div class="flex flex-col gap-4">
<input-tooltip
v-if="showGPU"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just remove this v-if condition and remove showGPU prop since it will always be true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, it's just check for only 2 solutions not the rest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please refer to replies above

inline
tooltip="
Selecting a Node with GPU.
When selecting a node with GPU resources, please make sure that you have a rented node. To rent a node and gain access to GPU capabilities, you can use our dashboard.
"
>
<v-switch
color="primary"
inset
label="GPU"
:model-value="hasGPUModel"
hide-details
@update:model-value="onUpdateHasGPU"
/>
</input-tooltip>

<v-switch
color="primary"
inset
label="Rented By Me"
:model-value="rentedByMeModel"
hide-details
@update:model-value="onUpdateRentedByMe"
/>

<input-tooltip
inline
tooltip="Click to know more about dedicated machines."
:href="manual?.dedicated_machines"
>
<v-switch
color="primary"
inset
label="Rentable"
:model-value="dedicatedModel"
hide-details
@update:model-value="onUpdateDedicated"
/>
</input-tooltip>

<input-tooltip
inline
tooltip="Renting capacity on certified nodes is charged 25% extra."
>
<v-switch
color="primary"
inset
label="Certified"
:model-value="certifiedModel"
hide-details
@update:model-value="onUpdateCertified"
/>
</input-tooltip>
</div>
</template>

<script setup lang="ts">
import { computed } from "vue";

import { manual } from "@/utils/manual";
import { solutionType } from "@/types";

import { useRoute } from "vue-router";

const props = defineProps({
rentedByMe: Boolean,
dedicated: Boolean,
certified: Boolean,
hasGPU: Boolean,
});
const emit = defineEmits(["update:rentedByMe", "update:dedicated", "update:certified", "update:hasGPU"]);

const route = useRoute();

const rentedByMeModel = computed({
get: () => !!props.rentedByMe,
set: val => emit("update:rentedByMe", val),
});

const dedicatedModel = computed({
get: () => !!props.dedicated,
set: val => emit("update:dedicated", val),
});

const certifiedModel = computed({
get: () => !!props.certified,
set: val => emit("update:certified", val),
});

const hasGPUModel = computed({
get: () => !!props.hasGPU,
set: val => emit("update:hasGPU", val),
});

const showGPU = computed(() => route.meta.title == solutionType.fullvm || route.meta.title == solutionType.openwebui);

function onUpdateRentedByMe(val: boolean | null) {
rentedByMeModel.value = !!val;
}

function onUpdateDedicated(val: boolean | null) {
dedicatedModel.value = !!val;
}

function onUpdateCertified(val: boolean | null) {
certifiedModel.value = !!val;
}

function onUpdateHasGPU(val: boolean | null) {
hasGPUModel.value = !!val;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think inline change the values in template would be better, Those founciton are not used anywhere else
example :

:model-value="(val)=> gpuModule = val"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, but it caused type-check errors, let me try adding types there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0oM4R I tried it, but it caused the same error I mentioned, so I returned to the previous solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  <v-switch
      color="primary"
      inset
      label="Rented By Me"
      :model-value="rentedByMeModel"
      hide-details
      @update:model-value="(val) => rentedByMeModel = !!val"
    />

this works fine with me without any errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samaradel please check this comment

</script>

<script lang="ts">
export default {
name: "RentalFilterSwitches",
};
</script>
3 changes: 1 addition & 2 deletions packages/playground/src/components/k8s_deployment_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<span>
This might happen because the node is down or it's not reachable
<span v-if="showEncryption">
or the deployment{{ count - items.length > 1 ? "s are" : " is" }} encrypted by another key
</span>.
or the deployment{{ count - items.length > 1 ? "s are" : " is" }} encrypted by another key </span>.
</span>
<v-tooltip location="top" text="Show failed deployments">
<template #activator="{ props: tooltipProps }">
Expand Down
Loading