Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
16 lines
627 B
TypeScript
16 lines
627 B
TypeScript
/**
|
|
* Viewer city for discovery lists (home popular/category, category landing).
|
|
*
|
|
* - Guest / incomplete profile → no city filter (nationwide — marketing cold start)
|
|
* - Logged-in with `profile.cityId` → that city
|
|
*
|
|
* City-scoped URLs (`/city/...`, category+city combo) always use the URL city
|
|
* and do not call this helper. Home city-preview strip is separate (cookie).
|
|
*/
|
|
export function resolveViewerDiscoveryCityId(profileCityId: number | null | undefined, isLoggedIn: boolean): number | undefined {
|
|
if (!isLoggedIn) return undefined
|
|
if (profileCityId == null) return undefined
|
|
|
|
return profileCityId
|
|
}
|