Skip to content

Commit 6a45f3f

Browse files
committed
default view is mobile if provide/inject fails
1 parent 561186e commit 6a45f3f

6 files changed

Lines changed: 26 additions & 27 deletions

File tree

apps/oem-flood-finder/frontend/src/views/FinderView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const {
6666
const locationSortMode = ref<PinboardTypes.SortMode>(
6767
['located', 'watching'].includes(userLocationState.value) ? 'DistAsc' : '',
6868
)
69-
const isMobile = inject(IS_MOBILE_KEY, ref(false))
69+
const isMobile = inject(IS_MOBILE_KEY, ref(true))
7070
7171
// computed refs
7272
const currentLocations = computed(() => {

apps/oem-flood-finder/frontend/src/views/ResourcesView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { IconChevronLeft } from '@phila/phila-ui-core/icons'
66
import { IS_MOBILE_KEY } from '@pinboard/ui'
77
import { inject, ref } from 'vue'
88
9-
const isMobile = inject(IS_MOBILE_KEY, ref(false))
9+
const isMobile = inject(IS_MOBILE_KEY, ref(true))
1010
const router = useRouter()
1111
</script>
1212

apps/primary-care-finder/frontend/src/views/FinderView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const defaultFilterState: PrimaryCareFilters = {
7373
},
7474
}
7575
76-
const isMobile = inject(IS_MOBILE_KEY, ref(false))
76+
const isMobile = inject(IS_MOBILE_KEY, ref(true))
7777
const { t } = useI18n()
7878
const { locations, languages, isLoading, errorMessage, geojson } = useLocations()
7979
const { filterChipDefinitions } = useFilterChipDefinitions(languages)

apps/primary-care-finder/frontend/src/views/InfoView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n'
44
import { IS_MOBILE_KEY, PinboardInfoPage } from '@pinboard/ui'
55
66
const { t } = useI18n()
7-
const isMobile = inject(IS_MOBILE_KEY, ref(false))
7+
const isMobile = inject(IS_MOBILE_KEY, ref(true))
88
99
const sections = computed(() => [
1010
{ id: 'insurance', title: t('introPage.section2Title') },

packages/eslint-config/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"@eslint/js": "catalog:",
1212
"eslint": "catalog:",
1313
"eslint-config-prettier": "catalog:",
14-
"eslint-plugin-turbo": "^2.10.6",
1514
"eslint-plugin-vue": "catalog:",
16-
"eslint-plugin-vue-scoped-css": "^3.1.1",
1715
"globals": "catalog:",
1816
"typescript": "catalog:",
19-
"typescript-eslint": "catalog:"
17+
"typescript-eslint": "catalog:",
18+
"eslint-plugin-turbo": "^2.10.6",
19+
"eslint-plugin-vue-scoped-css": "^3.1.1"
2020
}
2121
}

packages/ui/src/composables/useInitPinboardApp.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@ import { useIsMobile } from './useIsMobile'
44
import { IS_MOBILE_KEY } from '../keys'
55

66
export function useInitPinboardApp(localeAppKey?: string) {
7-
const { locale, init, setLocale } = localeAppKey ? useLocale(localeAppKey) : {}
8-
if (init) init()
9-
107
const infoSheetOpen = ref(false)
118
const isDraggingSheet = ref(false)
129
const dragY = ref(0)
10+
const isMobile = useIsMobile()
11+
const { locale, init, setLocale } = localeAppKey ? useLocale(localeAppKey) : {}
12+
13+
if (init) init()
14+
provide(IS_MOBILE_KEY, isMobile)
15+
16+
/* Drag-down-to-dismiss. BottomSheet's built-in drag is snap-point based
17+
* and a single snap point ([60]) clamps it to no movement, so we layer
18+
* our own pointer tracking on top: translate the sheet to follow the
19+
* pointer, dismiss past DRAG_DISMISS_THRESHOLD on release, otherwise
20+
* spring back. Clicks (zero delta) pass through. */
21+
const DRAG_DISMISS_THRESHOLD = 160
22+
let dragStartY = 0
23+
24+
onBeforeUnmount(() => {
25+
document.removeEventListener('pointermove', onSheetPointerMove)
26+
document.removeEventListener('pointerup', onSheetPointerUp)
27+
document.removeEventListener('pointercancel', onSheetPointerUp)
28+
})
1329

1430
function openInfoSheet(event: Event) {
1531
event.preventDefault()
@@ -22,14 +38,6 @@ export function useInitPinboardApp(localeAppKey?: string) {
2238
dragY.value = 0
2339
}
2440

25-
/* Drag-down-to-dismiss. BottomSheet's built-in drag is snap-point based
26-
* and a single snap point ([60]) clamps it to no movement, so we layer
27-
* our own pointer tracking on top: translate the sheet to follow the
28-
* pointer, dismiss past DRAG_DISMISS_THRESHOLD on release, otherwise
29-
* spring back. Clicks (zero delta) pass through. */
30-
const DRAG_DISMISS_THRESHOLD = 160
31-
let dragStartY = 0
32-
3341
function onSheetPointerDown(e: PointerEvent) {
3442
dragStartY = e.clientY
3543
dragY.value = 0
@@ -57,15 +65,6 @@ export function useInitPinboardApp(localeAppKey?: string) {
5765
}
5866
}
5967

60-
const isMobile = useIsMobile()
61-
provide(IS_MOBILE_KEY, isMobile)
62-
63-
onBeforeUnmount(() => {
64-
document.removeEventListener('pointermove', onSheetPointerMove)
65-
document.removeEventListener('pointerup', onSheetPointerUp)
66-
document.removeEventListener('pointercancel', onSheetPointerUp)
67-
})
68-
6968
return {
7069
isMobile,
7170
locale,

0 commit comments

Comments
 (0)