The Resources page (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/asubap/website/llms.txt
Use this file to discover all available pages before exploring further.
/resources) presents the chapter’s document and file library to authenticated non-sponsor members. Resources are grouped into categories with a resourceType of either "chapter" (internal chapter materials) or "firm" (recruiting and employer resources). A Fuse.js powered search bar filters across category names, descriptions, and the individual resource names and descriptions. Sponsors are silently redirected away from this page on mount.
Access Control
On mount,ResourcesPage inspects the role from useAuth(). If the role is "sponsor" (checked both as a string and as an object with type === "sponsor"), the component calls window.history.back() or navigates to /auth/Home. The component also returns null during the redirect to prevent any flash of content.
Alumni members can access the Resources page. The only restriction is on sponsors. If you need to block alumni from a future resource category, add a
canAccessFeature check from utils/permissions.ts.Data Model
Category
resource_type: "firm" | "chapter" | null. Null values default to "firm":
Resource
Fetching Resources
useEffect keyed on session. If session.access_token is absent, the effect returns early without fetching. Loading and error states are tracked with loading and error booleans.
Fuzzy Search
Fuse.js is configured with a0.4 threshold (more permissive than the network directory) and searches across both category-level and resource-level fields:
Auto-Expand on Search
Categories are collapsed by default. When the search query is non-empty, all filtered categories are automatically expanded; when the query is cleared, all collapse:expandedCategories by adding or removing the category id from the Set.
Page Layout
After filtering, categories are split byresourceType and rendered in two labelled sections:
ResourceCategory Component
ResourceCategory renders a single accordion. The header row shows:
- Category name and description
- Resource count badge (e.g.
3 resources) - Chevron icon (up/down)
expanded prop for controlled mode (used by the page) or falls back to internal useState for standalone use:
- A file-type icon (PDF →
FileText, image →Image, other →File) - Resource name and description
- “Added” date (formatted with
toLocaleDateString) - A preview eye button
File Type Icons
Resource Preview
Clicking the eye icon opensResourcePreviewModal with the selected resource. The button is disabled and styled opacity-50 cursor-not-allowed when resource.signed_url is null.
ResourcePreviewModal consumes signed_url directly — the signed URL is returned by the backend and is time-limited. If a URL has expired, the preview will fail; page refresh fetches fresh signed URLs.
Error and Loading States
| State | UI |
|---|---|
loading === true | <LoadingSpinner text="Loading resources..." size="lg" /> centred in main |
error !== null | Red alert box with the error string |
| No results after search | ”No resources available at this time.” centred paragraph |
| Sponsor role | Component returns null; redirect fires in useEffect |
Extending Resources
Adding a new resource type
Adding a new resource type
The
resourceType discriminator is currently "firm" | "chapter". To add a third section (e.g., "external"):- Update the
RawCategoryData.resource_typeunion type inResourcesPage. - Add
"external"to theCategory.resourceTypetype. - Add a
filteredExternalCategoriesfilter and a new section in the JSX below the Firm Resources section. - Update the backend to return
resource_type: "external"for the new categories.
Changing the Fuse.js threshold
Changing the Fuse.js threshold
The current
threshold: 0.4 is more lenient than the network directory’s 0.3. A lower threshold (closer to 0) returns only exact matches; a higher threshold (closer to 1) allows very fuzzy matches. Adjust fuseOptions.threshold in ResourcesPage to tune relevance.Per-resource filtering
Per-resource filtering
The current implementation filters at the category level — if any resource within a category matches, the whole category is returned. To filter at the resource level, run a second Fuse pass inside the
filteredCategories.map step to filter category.resources and return only matching resources.