mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 16:34:26 +00:00
Add theme support to user settings and related components
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
type SaveFileResponse,
|
||||
type UploadFilesResponse,
|
||||
} from './api';
|
||||
import { UserRole, type User } from './models';
|
||||
import { UserRole, Theme, type User } from './models';
|
||||
|
||||
// Mock user data for testing
|
||||
const mockUser: User = {
|
||||
@@ -17,6 +17,7 @@ const mockUser: User = {
|
||||
email: 'test@example.com',
|
||||
displayName: 'Test User',
|
||||
role: UserRole.Editor,
|
||||
theme: Theme.Dark,
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
lastWorkspaceId: 1,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isUser, type User, type UserRole } from './models';
|
||||
import { isUser, type User, type UserRole, type Theme } from './models';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -55,6 +55,7 @@ export interface CreateUserRequest {
|
||||
displayName: string;
|
||||
password: string;
|
||||
role: UserRole;
|
||||
theme?: Theme;
|
||||
}
|
||||
|
||||
// UpdateUserRequest holds the request fields for updating a user
|
||||
@@ -63,6 +64,7 @@ export interface UpdateUserRequest {
|
||||
displayName?: string;
|
||||
password?: string;
|
||||
role?: UserRole;
|
||||
theme?: Theme;
|
||||
}
|
||||
|
||||
export interface LookupResponse {
|
||||
@@ -126,6 +128,7 @@ export interface UpdateProfileRequest {
|
||||
email?: string;
|
||||
currentPassword?: string;
|
||||
newPassword?: string;
|
||||
theme?: Theme;
|
||||
}
|
||||
|
||||
// DeleteAccountRequest represents a user account deletion request
|
||||
|
||||
@@ -63,6 +63,7 @@ describe('Models Type Guards', () => {
|
||||
email: 'test@example.com',
|
||||
displayName: 'Test User',
|
||||
role: UserRole.Editor,
|
||||
theme: Theme.Dark,
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
lastWorkspaceId: 1,
|
||||
};
|
||||
@@ -76,6 +77,7 @@ describe('Models Type Guards', () => {
|
||||
id: 1,
|
||||
email: 'test@example.com',
|
||||
role: UserRole.Editor,
|
||||
theme: Theme.Dark,
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
lastWorkspaceId: 1,
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface User {
|
||||
email: string;
|
||||
displayName?: string;
|
||||
role: UserRole;
|
||||
theme: Theme;
|
||||
createdAt: string;
|
||||
lastWorkspaceId: number;
|
||||
}
|
||||
@@ -28,6 +29,8 @@ export function isUser(value: unknown): value is User {
|
||||
: true) &&
|
||||
'role' in value &&
|
||||
isUserRole((value as User).role) &&
|
||||
'theme' in value &&
|
||||
(value as User).theme in Theme &&
|
||||
'createdAt' in value &&
|
||||
typeof (value as User).createdAt === 'string' &&
|
||||
'lastWorkspaceId' in value &&
|
||||
@@ -309,6 +312,7 @@ export interface UserProfileSettings {
|
||||
email?: string;
|
||||
currentPassword?: string;
|
||||
newPassword?: string;
|
||||
theme?: Theme;
|
||||
}
|
||||
|
||||
export interface ProfileSettingsState {
|
||||
|
||||
Reference in New Issue
Block a user