User Dashboard & Control Panel UI
Relevant source files
The following files were used as context for generating this wiki page:
- src/client/user/index.tsx
- src/client/user/components/CreateUrlModal/index.tsx
- src/client/user/components/CreateUrlModal/CreateLinkForm.tsx
- src/client/user/widgets/LinkInfoEditor.tsx
- src/client/user/components/CreateUrlModal/AddDescriptionForm.tsx
- test/end-to-end/DrawerLogin.spec.ts
- src/client/apiintegration/index.tsx
The User Dashboard & Control Panel UI provides authorized users with a centralized interface to manage short links, files, and account-level integrations. It serves as the primary workspace where users create new links, monitor link statistics, and configure metadata for public discovery.
The UI is structured around a central link table for navigation and a drawer-based control panel for detailed link management. It integrates with Google Analytics to track user engagement and employs Redux for state management across the dashboard's lifecycle.
Sources: src/client/user/index.tsx:18-87, README.md:38-42
Core Dashboard Architecture
The dashboard is gated by authentication and initializes by fetching the user's URLs, email validation rules, and system messages upon a successful login. It utilizes a BaseLayout to provide consistent navigation and a Drawer component to wrap the main content area.
Component Hierarchy
The following diagram illustrates the structural relationship between the main dashboard components.
Sources: src/client/user/index.tsx:55-83
Feature Summary
| Component | Functionality |
|---|---|
UserLinkTable | Displays a list of existing short links with their respective targets and tags. |
CreateUrlModal | A multi-step modal for creating URL, file, or bulk CSV-based short links. |
EmptyState | Rendered when a user has no links and no active search filters are applied. |
ConfettiSurvey | Displays user feedback surveys based on environment configuration. |
AnnouncementModal | Shows system-wide updates to the user upon login. |
Sources: src/client/user/index.tsx:75-81, README.md:124-131
Link Creation Workflow
The CreateUrlModal manages the creation of three distinct link types: standard URL redirects, file-hosted links, and bulk CSV uploads. The process is divided into two primary steps: initial creation and optional metadata configuration.
Multi-Step Creation Flow
Link Types and Constraints
The creation form enforces specific validation rules based on the selected link type:
- URL: Requires a valid
longUrland ashortUrlconsisting of lowercase letters, numbers, and hyphens. - File: Supports file uploads up to 20MB.
- Bulk (.csv): Allows uploading up to 1000 links in a single CSV file with a size limit of 10MB.
- Tags: Users can add up to 3 tags per link to aid in classification.
Sources: src/client/user/components/CreateUrlModal/CreateLinkForm.tsx:102-126, src/client/user/components/CreateUrlModal/CreateLinkForm.tsx:189-215
Link Information Management
Once a link is created, users can modify its metadata through the LinkInfoEditor. This interface allows updates to the contact email and public-facing description, which are displayed on error pages or the search directory.
Metadata Validation Logic
| Field | Validation Rules | Logic |
|---|---|---|
contactEmail | Optional; must match whitelist glob if provided. | `!contactEmail |
description | Max 200 characters; Printable ASCII only. | description.length <= 200 && isPrintableAscii(description) |
Sources: src/client/user/widgets/LinkInfoEditor.tsx:84-88, src/client/user/components/CreateUrlModal/AddDescriptionForm.tsx:40-51
Control Panel & Drawer Actions
The control panel, typically housed in a slide-out Drawer, provides advanced management capabilities for individual links.
- Toggle Visibility: Users can switch links between
activeandinactivestates. Inactive links return a 404 error or a "Link not available" page. - Long URL Update: Users can change the destination of an existing short link.
- Link Transfer: Links can be transferred to other authorized users by entering their government email address. A successful transfer automatically closes the drawer and displays a success snackbar.
- Tag Management: Users can add or remove tags to update link categorization.
Sources: test/end-to-end/DrawerLogin.spec.ts:50-100, test/end-to-end/DrawerLogin.spec.ts:160-185
API Integration Interface
The dashboard includes a dedicated "API Integration" page for users requiring programmatic access to link shortening features.
This page allows users to generate or regenerate their API key. The key is presented in a modal, and users must confirm they have copied it before it becomes hidden.
Sources: src/client/apiintegration/index.tsx:64-70, test/end-to-end/util/helpers.ts:413-425
Summary
The User Dashboard & Control Panel UI centralizes link management through a reactive, component-based interface. It ensures data integrity through strict validation at the point of link creation and metadata editing. By integrating features like bulk uploads, file hosting, and API key management, the dashboard provides a comprehensive suite for official link administration within the Singapore Government ecosystem.