@@ -4,6 +4,7 @@ import type {
|
||||
} from '@/domain/museum'
|
||||
|
||||
export type PoiCategoryId =
|
||||
| 'itinerary'
|
||||
| 'exhibition-hall'
|
||||
| 'cinema'
|
||||
| 'ticket-office'
|
||||
@@ -25,25 +26,37 @@ export interface PoiCategoryDefinition {
|
||||
keywords: readonly string[]
|
||||
categoryIds: readonly string[]
|
||||
iconTypes: readonly string[]
|
||||
excludedCategoryIds?: readonly string[]
|
||||
}
|
||||
|
||||
const definitions: PoiCategoryDefinition[] = [
|
||||
{
|
||||
id: 'exhibition-hall',
|
||||
label: '展厅',
|
||||
icon: 'exhibition',
|
||||
id: 'itinerary',
|
||||
label: '行程',
|
||||
icon: 'itinerary',
|
||||
order: 1,
|
||||
homeVisible: true,
|
||||
keywords: ['展厅', '展览', '展馆', 'exhibition_hall', 'touring_poi', 'hall'],
|
||||
categoryIds: ['exhibition_hall', 'exhibition_hall_entrance', 'touring_poi'],
|
||||
iconTypes: ['exhibition_hall', 'hall_entrance', 'exhibition']
|
||||
keywords: ['行程', '导览', '参观', 'touring_poi'],
|
||||
categoryIds: ['touring_poi'],
|
||||
iconTypes: ['touring', 'guide']
|
||||
},
|
||||
{
|
||||
id: 'exhibition-hall',
|
||||
label: '展览',
|
||||
icon: 'exhibition',
|
||||
order: 2,
|
||||
homeVisible: true,
|
||||
keywords: ['展厅', '展览', '展馆', 'exhibition_hall', 'hall'],
|
||||
categoryIds: ['exhibition_hall', 'exhibition_hall_entrance'],
|
||||
iconTypes: ['exhibition_hall', 'hall_entrance', 'exhibition'],
|
||||
excludedCategoryIds: ['touring_poi']
|
||||
},
|
||||
{
|
||||
id: 'cinema',
|
||||
label: '影院',
|
||||
icon: 'cinema',
|
||||
order: 2,
|
||||
homeVisible: false,
|
||||
order: 3,
|
||||
homeVisible: true,
|
||||
keywords: ['影院', '影厅', '剧场', '报告厅', 'cinema', 'theater'],
|
||||
categoryIds: ['space_theater'],
|
||||
iconTypes: ['cinema', 'theater']
|
||||
@@ -52,8 +65,8 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
id: 'ticket-office',
|
||||
label: '售票处',
|
||||
icon: 'ticket',
|
||||
order: 3,
|
||||
homeVisible: false,
|
||||
order: 6,
|
||||
homeVisible: true,
|
||||
keywords: ['售票处', '售票', '票务', 'ticket_office'],
|
||||
categoryIds: [],
|
||||
iconTypes: ['ticket_office']
|
||||
@@ -62,18 +75,18 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
id: 'service-center',
|
||||
label: '服务中心',
|
||||
icon: 'service',
|
||||
order: 4,
|
||||
homeVisible: false,
|
||||
order: 8,
|
||||
homeVisible: true,
|
||||
keywords: ['服务中心', '服务台', '咨询台', 'service_desk'],
|
||||
categoryIds: [],
|
||||
iconTypes: ['service_desk']
|
||||
},
|
||||
{
|
||||
id: 'dining',
|
||||
label: '餐饮',
|
||||
label: '餐厅',
|
||||
icon: 'restaurant',
|
||||
order: 5,
|
||||
homeVisible: false,
|
||||
homeVisible: true,
|
||||
keywords: ['餐饮', '餐厅', '快餐', '咖啡', 'restaurant', 'dining', 'food', 'cafe'],
|
||||
categoryIds: [],
|
||||
iconTypes: ['restaurant', 'dining', 'food', 'cafe']
|
||||
@@ -82,7 +95,7 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
id: 'souvenir',
|
||||
label: '文创',
|
||||
icon: 'bag',
|
||||
order: 6,
|
||||
order: 11,
|
||||
homeVisible: false,
|
||||
keywords: ['文创', '纪念品', '商店', 'souvenir', 'gift', 'shop'],
|
||||
categoryIds: [],
|
||||
@@ -100,9 +113,9 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
},
|
||||
{
|
||||
id: 'restroom',
|
||||
label: '卫生间',
|
||||
label: '洗手间',
|
||||
icon: 'restroom',
|
||||
order: 8,
|
||||
order: 4,
|
||||
homeVisible: true,
|
||||
keywords: ['卫生间', '洗手间', '厕所', 'toilet', 'accessible_toilet', 'restroom'],
|
||||
categoryIds: [],
|
||||
@@ -122,8 +135,8 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
id: 'stairs',
|
||||
label: '楼梯',
|
||||
icon: 'stairs',
|
||||
order: 10,
|
||||
homeVisible: true,
|
||||
order: 12,
|
||||
homeVisible: false,
|
||||
keywords: ['楼梯', 'stairs', 'stair'],
|
||||
categoryIds: [],
|
||||
iconTypes: ['stairs', 'stair']
|
||||
@@ -132,7 +145,7 @@ const definitions: PoiCategoryDefinition[] = [
|
||||
id: 'escalator',
|
||||
label: '扶梯',
|
||||
icon: 'escalator',
|
||||
order: 11,
|
||||
order: 10,
|
||||
homeVisible: true,
|
||||
keywords: ['扶梯', 'escalator'],
|
||||
categoryIds: [],
|
||||
@@ -145,11 +158,15 @@ export const POI_CATEGORIES = Object.freeze(
|
||||
)
|
||||
|
||||
const homeCategoryOrder: readonly PoiCategoryId[] = [
|
||||
'itinerary',
|
||||
'exhibition-hall',
|
||||
'cinema',
|
||||
'restroom',
|
||||
'dining',
|
||||
'ticket-office',
|
||||
'nursing-room',
|
||||
'service-center',
|
||||
'elevator',
|
||||
'stairs',
|
||||
'escalator'
|
||||
]
|
||||
|
||||
@@ -159,6 +176,25 @@ export const HOME_POI_CATEGORIES = Object.freeze(
|
||||
))
|
||||
)
|
||||
|
||||
const POI_CATEGORY_ICON_SYMBOLS: Readonly<Record<PoiCategoryId, string>> = {
|
||||
itinerary: 'poi-itinerary',
|
||||
'exhibition-hall': 'poi-exhibition-hall',
|
||||
cinema: 'poi-cinema',
|
||||
'ticket-office': 'poi-ticket-office',
|
||||
'service-center': 'poi-service-center',
|
||||
dining: 'poi-dining',
|
||||
souvenir: 'poi-souvenir',
|
||||
'nursing-room': 'poi-nursing-room',
|
||||
restroom: 'poi-restroom',
|
||||
elevator: 'poi-elevator',
|
||||
stairs: 'poi-stairs',
|
||||
escalator: 'poi-escalator'
|
||||
}
|
||||
|
||||
export const getPoiCategoryIconHref = (categoryId: PoiCategoryId) => (
|
||||
`/static/icons/poi/shortcut-icons.svg#${POI_CATEGORY_ICON_SYMBOLS[categoryId]}`
|
||||
)
|
||||
|
||||
type PoiCategorySource = Pick<MuseumPoi, 'name' | 'primaryCategory' | 'categories'>
|
||||
|
||||
const normalizeValue = (value?: string | null) => (value || '').trim().toLowerCase()
|
||||
@@ -177,6 +213,12 @@ export const matchesPoiCategory = (
|
||||
const normalizedCategoryIds = new Set(categories.map((category) => normalizeValue(category.id)))
|
||||
const normalizedIconTypes = new Set(categories.map((category) => normalizeValue(category.iconType)))
|
||||
|
||||
if (definition.excludedCategoryIds?.some((categoryId) => (
|
||||
normalizedCategoryIds.has(normalizeValue(categoryId))
|
||||
))) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (definition.categoryIds.some((categoryId) => normalizedCategoryIds.has(normalizeValue(categoryId)))) {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user