How crawlear-com/crawlearroutes works
Project Type and Purpose
• This is a full-stack, map-centric PWA built with Vite, React, Redux Toolkit, Supabase, and i18n.
• Its core use case is browsing and managing routes and events, with list views (generic item lists) at its heart.
a. Redux Store (itemListsSlice)
• Holds shared list state: items[], filterParams, paginationParams, query.
• Exposes selectors and actions (e.g., setFilter, setPage, setItems).
b. ItemsList Container Component (/src/components/ItemCardList/ItemCardList.tsx)
• A generic list wrapper using render props.
• Connects to Redux selectors to read items, filter, pagination.
• Passes a render function (renderItem) to display each item.
c. ItemsListFilter Component (ItemsListFilter.tsx)
• UI for entering a filter string.
• Dispatches setFilter(filterString) on user input.
d. ItemsPaginator Component (ItemsPaginator.tsx)
• UI for page controls (prev/next, page numbers).
• Dispatches setPage(pageNumber) on navigation.
e. Individual Item Cards (custom card components)
• Rendered by ItemCardList via render props.
• Example: RouteCard, EventCard, etc.
Relationships and Data Flow
• UI Event (e.g., typing in filter or clicking page) → dispatch Redux action → store updates slice state.
• Store State Change → ItemCardList re-selects items[] and passes them down via render props.
• Render Props → individual Item Card components for each item.
Architectural Patterns and Principles
• Redux Toolkit slice per list to avoid prop drilling and preserve state across navigation.
• TypeScript Generics (<T>) in ItemCardList for reuse across data types.
• Render Props pattern in ItemCardList to inject custom card UI.
• Separation of concerns: UI components vs. hooks vs. Redux store.