poradniki
This commit is contained in:
@@ -17,6 +17,14 @@ export const ROUTES = {
|
||||
advertising: '/reklama',
|
||||
guides: '/poradniki',
|
||||
guideBuying: '/poradniki/kupno-mieszkania',
|
||||
guideCredit: '/poradniki/kredyty-hipoteczne',
|
||||
guideRent: '/poradniki/wynajem',
|
||||
guideInvesting: '/poradniki/inwestowanie',
|
||||
guideRenovation: '/poradniki/remont-i-wykonczenie',
|
||||
guideLaw: '/poradniki/prawo-i-podatki',
|
||||
guideTopicList: '/poradniki/temat/:topicSlug',
|
||||
guideArticle: '/poradniki/artykul/:id',
|
||||
guideAdd: '/poradniki/dodaj',
|
||||
creditCalculator: '/kalkulator-zdolnosci',
|
||||
map: '/mapa',
|
||||
login: '/logowanie',
|
||||
@@ -46,6 +54,43 @@ export const ROUTES = {
|
||||
|
||||
export type RoutePath = (typeof ROUTES)[keyof typeof ROUTES];
|
||||
|
||||
// Kanoniczna lista tematów poradników. Slug = ostatni segment adresu i zarazem klucz w API
|
||||
// (/api/articles?topic=slug). `guide` to wbudowany, kompletny poradnik danego tematu.
|
||||
export type GuideTopicMeta = { slug: string; title: string; icon: string; guide: string };
|
||||
|
||||
export const GUIDE_TOPICS: GuideTopicMeta[] = [
|
||||
{ slug: 'kupno-mieszkania', title: 'Kupno mieszkania', icon: 'house', guide: ROUTES.guideBuying },
|
||||
{ slug: 'kredyty-hipoteczne', title: 'Kredyty hipoteczne', icon: 'percent', guide: ROUTES.guideCredit },
|
||||
{ slug: 'wynajem', title: 'Wynajem', icon: 'key', guide: ROUTES.guideRent },
|
||||
{ slug: 'inwestowanie', title: 'Inwestowanie', icon: 'chart', guide: ROUTES.guideInvesting },
|
||||
{ slug: 'remont-i-wykonczenie', title: 'Remont i wykończenie', icon: 'paint', guide: ROUTES.guideRenovation },
|
||||
{ slug: 'prawo-i-podatki', title: 'Prawo i podatki', icon: 'scale', guide: ROUTES.guideLaw },
|
||||
];
|
||||
|
||||
export function guideTopicBySlug(slug: string | undefined): GuideTopicMeta | undefined {
|
||||
return GUIDE_TOPICS.find((topic) => topic.slug === slug);
|
||||
}
|
||||
|
||||
// Kafelki tematów na /poradniki prowadzą do listy poradników danego tematu.
|
||||
export function guideTopicListPath(slug: string): string {
|
||||
return `/poradniki/temat/${slug}`;
|
||||
}
|
||||
|
||||
// Pojedynczy artykuł użytkownika.
|
||||
export function articlePath(id: number): string {
|
||||
return `/poradniki/artykul/${id}`;
|
||||
}
|
||||
|
||||
// Formularz dodawania artykułu z opcjonalnym wstępnie wybranym tematem.
|
||||
export function guideAddPath(topicSlug?: string): string {
|
||||
return topicSlug ? `${ROUTES.guideAdd}?temat=${encodeURIComponent(topicSlug)}` : ROUTES.guideAdd;
|
||||
}
|
||||
|
||||
// Zgodność wstecz: mapa tytuł tematu -> wbudowany poradnik (używana przy kartach polecanych artykułów).
|
||||
export const GUIDE_TOPIC_ROUTES: Record<string, string> = Object.fromEntries(
|
||||
GUIDE_TOPICS.map((topic) => [topic.title, topic.guide]),
|
||||
);
|
||||
|
||||
// Szczegóły oferty: identyfikator trafia do adresu, nie do stanu Reacta.
|
||||
export function listingPath(id: number): string {
|
||||
return `/oferta/${id}`;
|
||||
@@ -123,6 +168,7 @@ export const ADMIN_TAB_PATHS = {
|
||||
support: 'pomoc-i-kontakt',
|
||||
advertisingEnquiries: 'zapytania-o-reklame',
|
||||
reports: 'zgloszenia',
|
||||
articleRequests: 'poradniki-prosby',
|
||||
payments: 'platnosci',
|
||||
stats: 'statystyki',
|
||||
settings: 'ustawienia',
|
||||
@@ -169,4 +215,5 @@ export const PROTECTED_PATHS: string[] = [
|
||||
ROUTES.favorites,
|
||||
ROUTES.messages,
|
||||
ROUTES.comparison,
|
||||
ROUTES.guideAdd,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user