Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

feat: grid mobile warning #533

Merged
merged 1 commit into from
Nov 7, 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
2 changes: 1 addition & 1 deletion components/ModalTemplateDefault.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { modal, closeModal } = useModal()
<div class="flex flex-col rounded-12 bg-neutral-98 p-6 text-center">
<img
:src="modal?.data?.icon || '/images/up-error.png'"
class="mx-auto mb-6 max-w-[150px]"
class="mx-auto mb-6 mt-4 max-w-[150px]"
alt=""
/>
<div class="heading-inter-21-semi-bold pb-4">
Expand Down
16 changes: 16 additions & 0 deletions domains/grid/components/GridView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
gridRowHeightRatio,
selectedGridId,
isSavingGrid,
mobileLimitationsDisplayed,
} = storeToRefs(useGridStore())
const {
saveGrid,
Expand All @@ -21,6 +22,8 @@ const {
getGridById,
gridsForTabs,
} = useGrid()
const { showModal } = useModal()
const { formatMessage } = useIntl()
const gridContainer = ref<HTMLElement | null>(null)
const { width } = useElementSize(gridContainer)
const gridWidgets = ref<GridWidget[]>([])
Expand Down Expand Up @@ -161,6 +164,19 @@ watch(
} else {
hasUnsavedGrid.value = false
}

// show mobile limitations modal (only once)
if (isMobile.value && !mobileLimitationsDisplayed.value) {
showModal<DefaultModalData>({
data: {
icon: '/images/grid.svg',
title: formatMessage('grid_mobile_limitations_title'),
message: formatMessage('grid_mobile_limitations_message'),
confirmButtonText: formatMessage('grid_mobile_limitations_confirm'),
},
})
mobileLimitationsDisplayed.value = true
}
} else {
gridWidgets.value = getSelectedGridWidgets(updatedViewedGrid)
}
Expand Down
6 changes: 6 additions & 0 deletions public/images/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions stores/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const useGridStore = defineStore(
const gridRowHeightRatio = ref(DEFAULT_GRID_ROW_HEIGHT_RATIO)
const gridChainId = ref<string>(DEFAULT_NETWORK_CHAIN_ID)
const tempGrids = ref<Record<string, Grid[]>>({})
const mobileLimitationsDisplayed = ref(false)

// We use tempGrid as a proxy to the actual grid data stored in tempGrids
const tempGrid = computed<Grid[]>({
Expand Down Expand Up @@ -45,6 +46,7 @@ export const useGridStore = defineStore(
selectedGridId,
gridRowHeightRatio,
gridChainId,
mobileLimitationsDisplayed,
}
},
{
Expand All @@ -55,6 +57,7 @@ export const useGridStore = defineStore(
'selectedGridId',
'gridRowHeightRatio',
'gridChainId',
'mobileLimitationsDisplayed',
'tempGrids',
],
key: STORAGE_KEY.GRID_STORE,
Expand Down
3 changes: 3 additions & 0 deletions translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"error_rejected_request": "You rejected the request",
"dapp_showcase_06_image": "/images/universal-grave-dapp.jpg",
"button_create_testnet_profile": "CREATE A TESTNET PROFILE",
"grid_mobile_limitations_title": "Editing on mobile",
"modal_switch_network_title": "Change extension network",
"hero_title_01": "Discover",
"modal_follower_title": "Followers",
Expand Down Expand Up @@ -61,6 +62,7 @@
"tooltip_text_copy_raw": "Copy raw",
"add_widget_section_website": "Website",
"data_provider_graph_description": "Load data via the our Envio indexing service. This results in faster loading times and smoother UX, however inappropriate content might be removed.",
"grid_mobile_limitations_confirm": "I understand",
"transak_success_message": "Please note that it can take some time for your balance to update.",
"missing_asset_label_added": "Added",
"error_no_accounts": "Account not found.",
Expand Down Expand Up @@ -268,6 +270,7 @@
"dapp_showcase_02_url": "https://universalswaps.io/",
"token_collection_of": "Owns {count}",
"add_widget_images_description": "Allows to embed image files.",
"grid_mobile_limitations_message": "some editing features are not available on mobile right now",
"add_widget_text_title_placeholder": "Header text",
"data_provider_rpc_description": "Loads data directly from the blockchain using an RPC provider. If a custom RPC provider (This feature will be added later) is used the read data can not be manipulated by us. \n\nWill result in slower loading times during the loading of assets and some app features might be limited.",
"move_widget_description": "Please select to which Grid you want to move this widget.",
Expand Down
7 changes: 7 additions & 0 deletions types/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ export type ModalQueryParams = {
export type ModalData = {
[key: string]: any
}

export type DefaultModalData = {
message: string
title?: string
confirmButtonText?: string
icon?: string
}
Loading