From 61e10dd45a820bb582c78b5ee17a41c0aa090e70 Mon Sep 17 00:00:00 2001 From: safavimohadeseh78 Date: Wed, 17 Jun 2026 13:51:29 +0330 Subject: [PATCH] remove toPersianDigits --- .cursor/rules/responsive-data-fetching.mdc | 26 +++++++++++++++++++ src/components/BasicPacks/BasicInput.vue | 23 +++++++++------- .../BasicPriceInput/src/BasicPriceInput.vue | 6 ++--- .../BasicPriceInput/src/utils/usePrice.ts | 18 +------------ src/utils/useCardNumber.ts | 2 +- src/utils/usePrice.ts | 10 ++++--- .../base/earnMoney/components/GiftCard.vue | 3 ++- src/views/base/fund/info/components/Item.vue | 7 ++--- .../base/home/components/CurrentPrice.vue | 2 +- src/views/base/home/components/PriceChart.vue | 8 ++---- .../desktop/components/DesktopLivePrice.vue | 1 - .../components/TransactionDetailPanel.vue | 8 +++--- src/views/base/wallet/components/Item.vue | 6 ++--- 13 files changed, 65 insertions(+), 55 deletions(-) create mode 100644 .cursor/rules/responsive-data-fetching.mdc diff --git a/.cursor/rules/responsive-data-fetching.mdc b/.cursor/rules/responsive-data-fetching.mdc new file mode 100644 index 0000000..32c0c7c --- /dev/null +++ b/.cursor/rules/responsive-data-fetching.mdc @@ -0,0 +1,26 @@ +# Responsive layout vs data fetching + +When adding or changing pages with mobile/desktop views: + +## UI layer (responsive) + +- Switch layouts with **`v-show`**, not **`v-if`**, so resize does not destroy child components. +- Prefer `ResponsiveViewPair` (`src/layouts/components/ResponsiveViewPair.vue`) or the home shell pattern. +- Keep **``** outside responsive chrome wrappers (header/topbar only in chrome components). +- Modal vs ActionSheet may use `v-if` by breakpoint; they must not own initial page data fetching. + +## Data layer (fetch once) + +- Call the page composable **once** in the route `index.vue` shell (e.g. `useXPage()` / `useXPageProvider()`). +- Put `onMounted` API calls only in that shell composable, never in `mobile/*` or `desktop/*` views. +- Mobile/Desktop views use **`useXPageContext()`** (provide/inject) — read-only UI. +- Do not call APIs inside `useDesktopBreakpoint()` watchers. + +## Shared caches + +- Use `runOnceAsync` (`src/composables/useOnceAsync.ts`) for store-level dedup when the same endpoint may be hit from multiple mounts. +- Reuse existing module caches (`useWalletAssets`, Pinia stores) before adding new fetch logic. + +## Verify + +- Open Network tab, load a page, resize across 768px — **no duplicate requests** for the same endpoint. diff --git a/src/components/BasicPacks/BasicInput.vue b/src/components/BasicPacks/BasicInput.vue index 95db065..9012c27 100644 --- a/src/components/BasicPacks/BasicInput.vue +++ b/src/components/BasicPacks/BasicInput.vue @@ -35,7 +35,7 @@