Skip to content

Commit

Permalink
style: use Teleport for proper page hierarchy:
Browse files Browse the repository at this point in the history
- Introduced the `attach` attribute to the `v-dialog` component for better dialog positioning.
- Created a new HTML element with the id `modals` to serve as the teleport target for dialogs.
- Updated Vuetify defaults to include the `attach` attribute, ensuring consistent dialog behavior across the application.
  • Loading branch information
Mahmoud-Emad committed Jun 25, 2024
1 parent c4c73fb commit f07edad
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 29 deletions.
1 change: 1 addition & 0 deletions packages/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
</div>
</div>
<div id="app"></div>
<div id="modals"></div>
<script defer type="module" src="/src/main.ts"></script>
<script src="/loader/loader.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/components/TfOfflineNotifier.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<VDialog scrollable persistent min-width="400px" max-width="700px" :model-value="offline || failed">
<VDialog scrollable persistent min-width="400px" max-width="700px" :model-value="offline || failed" attach="#modals">
<VCard>
<VCardTitle class="v-card-title font-weight-black text-center text-h5 bg-primary py-3" v-text="title" />
<VCardText class="text-center">
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/components/app_info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@update:model-value="setOpenInfo($event)"
:width="loading ? 'auto' : '60%'"
scrollable
attach="#modals"
>
<v-card v-if="loading" class="d-flex justify-center align-center pa-10">
<v-progress-circular indeterminate />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
</template>
</weblet-layout>

<v-dialog width="800" v-model="contractStateDialog">
<v-dialog width="800" v-model="contractStateDialog" attach="#modals">
<v-card>
<v-toolbar color="primary" class="custom-toolbar">
<p class="mb-5">Contract lock Details</p>
Expand Down Expand Up @@ -197,7 +197,7 @@
</v-card>
</v-dialog>

<v-dialog width="800" v-model="deletingDialog">
<v-dialog width="800" v-model="deletingDialog" attach="#modals">
<v-card>
<v-card-title class="bg-primary"> Delete the following contracts? </v-card-title>
<v-alert class="ma-4" type="warning" variant="tonal"
Expand All @@ -219,7 +219,7 @@
</v-card>
</v-dialog>

<v-dialog width="800" v-model="unlockDialog">
<v-dialog width="800" v-model="unlockDialog" attach="#modals">
<v-card>
<v-card-title class="bg-primary">
Unlock the following Contract<span v-if="selectedContracts.length > 1">s</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-row justify="center">
<v-dialog model-value @update:model-value="$emit('close')" scrollable>
<v-dialog model-value @update:model-value="$emit('close')" scrollable attach="#modals">
<v-card>
<v-card-title class="d-flex flex-column" v-if="!onlyJson">
<div class="d-flex justify-center">
Expand Down
7 changes: 6 additions & 1 deletion packages/playground/src/components/deposit_dialog.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<v-container>
<v-dialog transition="dialog-bottom-transition" v-model="depositDialog" @update:model-value="closeDialog">
<v-dialog
transition="dialog-bottom-transition"
v-model="depositDialog"
@update:model-value="closeDialog"
attach="#modals"
>
<v-card>
<VCardTitle class="bg-primary">Deposit TFT</VCardTitle>
<v-card-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</template>
</v-tooltip>

<v-dialog transition="dialog-bottom-transition" v-model="showDialog">
<v-dialog transition="dialog-bottom-transition" v-model="showDialog" attach="#modals">
<v-card>
<v-card-title style="color: #ffcc00; font-weight: bold">Failed Deployments</v-card-title>
<v-divider color="#FFCC00" />
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/components/logger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</v-expansion-panels>
</VBottomNavigation>

<v-dialog max-width="400px" v-model="clearDialog">
<v-dialog max-width="400px" v-model="clearDialog" attach="#modals">
<v-card>
<VCardTitle v-text="'Clear Logs'" />
<VCardText v-text="'This will delete all of your logs. Be careful this operation is irreversible!'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</template>
</ManageWorkerDialog>

<v-dialog v-if="caproverData" v-model="deployedDialog" scrollable width="500px">
<v-dialog v-if="caproverData" v-model="deployedDialog" scrollable width="500px" attach="#modals">
<v-card>
<v-card-title> <strong>Add your worker</strong> </v-card-title>

Expand Down
5 changes: 3 additions & 2 deletions packages/playground/src/components/manage_gateway_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@update:model-value="$emit('close')"
scrollable
:persistent="deleting || layout?.status === 'deploy'"
attach="#modals"
>
<weblet-layout
ref="layout"
Expand Down Expand Up @@ -40,7 +41,7 @@
</template>
</v-alert>

<v-dialog v-model="failedDomainDialog" max-width="400px" scrollable>
<v-dialog v-model="failedDomainDialog" max-width="400px" scrollable attach="#modals">
<v-card>
<v-card-title class="bg-warning">Failed Domains</v-card-title>

Expand Down Expand Up @@ -183,7 +184,7 @@
</weblet-layout>
</v-dialog>

<v-dialog v-model="requestDelete" max-width="600px">
<v-dialog v-model="requestDelete" max-width="600px" attach="#modals">
<v-card>
<v-card-title> Are you sure you want to delete the following gateways? </v-card-title>
<v-card-text class="d-flex flex-wrap">
Expand Down
3 changes: 2 additions & 1 deletion packages/playground/src/components/manage_worker_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
scrollable
:persistent="layout?.status === 'deploy' || deleting"
@update:model-value="$emit('close')"
attach="#modals"
>
<weblet-layout ref="layout" @back="$emit('back')">
<template #title><slot name="title"></slot> </template>
Expand Down Expand Up @@ -47,7 +48,7 @@
</weblet-layout>
</v-dialog>

<v-dialog width="50%" v-model="deletingDialog">
<v-dialog width="50%" v-model="deletingDialog" attach="#modals">
<v-card>
<v-card-title class="text-h5"> Are you sure you want to delete the following workers? </v-card-title>
<v-card-text>
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/components/node_details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@click:outside="() => $emit('close-dialog', false)"
transition="dialog-bottom-transition"
hide-overlay
attach="#modals"
>
<v-toolbar color="primary">
<div class="d-flex justify-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@keydown.esc="() => $emit('close')"
v-model="$props.open"
max-width="800"
attach="#modals"
>
<template v-slot:default>
<v-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@keydown.esc="() => $emit('close')"
v-model="$props.open"
max-width="800"
attach="#modals"
>
<template v-slot:default>
<v-form v-model="isValidForm">
Expand Down
8 changes: 7 additions & 1 deletion packages/playground/src/components/vm_deployment_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
</template>
</v-tooltip>

<v-dialog transition="dialog-bottom-transition" v-model="showDialog" max-width="500px" scrollable>
<v-dialog
transition="dialog-bottom-transition"
v-model="showDialog"
max-width="500px"
scrollable
attach="#modals"
>
<v-card>
<v-card-title style="font-weight: bold">Failed Deployments</v-card-title>
<v-divider color="#FFCC00" />
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/components/withdraw_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
max-width="50%"
v-model="withdrawDialog"
@update:model-value="closeDialog"
attach="#modals"
>
<v-card>
<v-card-title class="bg-primary"> Withdraw TFT </v-card-title>
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/dashboard/components/add_ip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
<v-container>
<v-container v-if="showDialogue">
<v-dialog v-model="showDialogue" max-width="600">
<v-dialog v-model="showDialogue" max-width="600" attach="#modals">
<v-card>
<v-card-title class="bg-primary">Add Public IP to Farm</v-card-title>
<v-card-text>
Expand Down Expand Up @@ -74,7 +74,7 @@
</form-validator>
<v-divider />
</v-card-text>
<v-dialog v-model="showIPs" max-width="500">
<v-dialog v-model="showIPs" max-width="500" attach="#modals">
<v-card>
<v-card-title class="text-h5">IPs range</v-card-title>
<v-card-text v-for="(IP, i) in IPs" :key="IP">{{ i + 1 }}- {{ IP }}</v-card-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</v-row>

<v-container v-if="showDialogue">
<v-dialog v-model="showDialogue" max-width="600">
<v-dialog v-model="showDialogue" max-width="600" attach="#modals">
<v-card>
<v-card-title class="bg-primary"> Create Farm </v-card-title>
<v-card-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</v-tooltip>

<template v-if="showDialogue">
<v-dialog v-model="showDialogue" max-width="600" @click:outside="reset">
<v-dialog v-model="showDialogue" max-width="600" @click:outside="reset" attach="#modals">
<v-card>
<v-card-title class="bg-primary">
Add a public config to your node with ID: {{ $props.nodeId }}
Expand Down Expand Up @@ -138,7 +138,7 @@

<!-- Remove Config Dialog -->
<template v-if="showClearDialogue">
<v-dialog v-model="showClearDialogue" width="650">
<v-dialog v-model="showClearDialogue" width="650" attach="#modals">
<v-card>
<v-card-title class="bg-primary"> Remove Public Config </v-card-title>
<v-card-text>Are you sure you want to remove this node's public config? </v-card-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>
</template>
</ListTable>
<v-dialog v-model="showDialogue" max-width="600">
<v-dialog v-model="showDialogue" max-width="600" attach="#modals">
<v-card>
<v-card-title class="text-subtitle-1">
<strong>Delete the following IPs?</strong>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<container>
<v-dialog v-model="openUnreserveDialog" max-width="600" class="custom-dialog">
<v-dialog v-model="openUnreserveDialog" max-width="600" class="custom-dialog" attach="#modals">
<v-card>
<v-card-title class="pt-4">
<span style="display: flex; align-items: center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</v-tooltip>

<span v-if="showDialogue">
<v-dialog v-model="showDialogue" max-width="600">
<v-dialog v-model="showDialogue" max-width="600" attach="#modals">
<v-card>
<v-card-title class="bg-primary"> Set Additional Fees </v-card-title>
<v-card-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</tr>

<v-container v-if="showDialogue">
<v-dialog v-model="showDialogue" max-width="600">
<v-dialog v-model="showDialogue" max-width="600" attach="#modals">
<v-card>
<v-toolbar color="primary" dark>
<v-toolbar-title class="custom-toolbar_title mb-6"> Add/Edit Stellar V2 Address </v-toolbar-title>
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/dashboard/dao_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
</v-card>
</v-window-item>
</v-window>
<v-dialog v-model="openVDialog" max-width="600" scrollable>
<v-dialog v-model="openVDialog" max-width="600" scrollable attach="#modals">
<v-card>
<v-card-title>Cast Vote</v-card-title>
<v-card-text>
Expand All @@ -235,7 +235,7 @@
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="openInfoModal" width="50vw">
<v-dialog v-model="openInfoModal" width="50vw" attach="#modals">
<v-card>
<v-card-title class="text-h5 my-2"> Proposals Information </v-card-title>
<v-divider></v-divider>
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/dashboard/twin_view.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<v-container v-if="editingTwin">
<v-dialog v-model="editingTwin" max-width="600">
<v-dialog v-model="editingTwin" max-width="600" attach="#modals">
<v-card>
<v-toolbar color="primary" dark class="custom-toolbar">Edit Twin</v-toolbar>
<div class="text-h2 pa-10">
Expand All @@ -15,7 +15,7 @@
</v-dialog>
</v-container>

<v-dialog v-model="openVotePopup" max-width="600">
<v-dialog v-model="openVotePopup" max-width="600" attach="#modals">
<v-card>
<v-toolbar color="primary" dark class="custom-toolbar bold-text">Vote Reminder</v-toolbar>
<v-card-text>There are {{ numberOfProposalsToVoteOn }} active proposals you can vote on now</v-card-text>
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/plugins/vuetify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const defaults = {
},
VDialog: {
width: "70%",
attach: "#modals",
},
};

Expand Down
3 changes: 2 additions & 1 deletion packages/playground/src/weblets/profile_manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class="mx-auto"
:model-value="$props.modelValue"
@update:model-value="handleProfileDialog($event)"
attach="#modals"
>
<template #activator="{ props }">
<VCard v-bind="props" class="pa-3 d-inline-flex align-center">
Expand Down Expand Up @@ -201,7 +202,7 @@
</template>
</VTooltip>

<v-dialog v-model="openAcceptTerms" fullscreen width="100%">
<v-dialog v-model="openAcceptTerms" fullscreen width="100%" attach="#modals">
<v-card v-if="!termsLoading">
<v-card-text class="pa-15" v-html="acceptTermsContent"></v-card-text>
<div class="terms-footer">
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/weblets/tf_contracts_list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</template>
</v-card>
<!-- locked amount Dialog -->
<v-dialog width="500" v-model="unlockDialog" v-if="lockedContracts?.totalAmountLocked">
<v-dialog width="500" v-model="unlockDialog" v-if="lockedContracts?.totalAmountLocked" attach="#modals">
<v-card>
<v-card-title class="bg-primary">
Unlock All Contracts
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/weblets/tf_deployment_list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
</template>
</weblet-layout>

<v-dialog v-model="deletingDialog" scrollable width="600">
<v-dialog v-model="deletingDialog" scrollable width="600" attach="#modals">
<v-card>
<v-card-title>
<strong>Delete the following deployments?</strong>
Expand Down

0 comments on commit f07edad

Please sign in to comment.