Fix type-check issues

This commit is contained in:
2025-05-18 16:36:20 +02:00
parent 3619cf4ed4
commit 60ab01b0c8
11 changed files with 41 additions and 38 deletions

View File

@@ -55,7 +55,9 @@ const MarkdownPreview: React.FC<MarkdownPreviewProps> = ({
const [filePath] = decodeURIComponent(
href.replace(`${baseUrl}/internal/`, '')
).split('#');
handleFileSelect(filePath);
if (filePath) {
handleFileSelect(filePath);
}
} else if (href.startsWith(`${baseUrl}/notfound/`)) {
// For non-existent files, show a notification
const fileName = decodeURIComponent(
@@ -105,9 +107,6 @@ const MarkdownPreview: React.FC<MarkdownPreviewProps> = ({
</a>
),
code: ({ children, className, ...props }: MarkdownCodeProps) => {
const language = className
? className.replace('language-', '')
: null;
return (
<pre className={className}>
<code {...props}>{children}</code>

View File

@@ -30,7 +30,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
const [formData, setFormData] = useState<UpdateUserRequest>({
email: '',
displayName: '',
role: undefined,
role: UserRole.Editor,
password: '',
});
@@ -58,7 +58,7 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
setFormData({
email: '',
displayName: '',
role: undefined,
role: UserRole.Editor,
password: '',
});
onClose();
@@ -88,9 +88,9 @@ const EditUserModal: React.FC<EditUserModalProps> = ({
<Select
label="Role"
required
value={formData.role}
value={formData.role ? formData.role.toString() : null}
onChange={(value) =>
setFormData({ ...formData, role: value as UserRole | undefined })
setFormData({ ...formData, role: value as UserRole })
}
data={[
{ value: UserRole.Admin, label: 'Admin' },

View File

@@ -139,7 +139,7 @@ const WorkspaceSwitcher: React.FC = () => {
truncate
c={
isSelected
? theme.colors.blue[
? (theme as any).colors.blue[
(theme as any).colorScheme === 'dark'
? 0
: 9

View File

@@ -83,7 +83,7 @@ const AccountSettings: React.FC<AccountSettingsProps> = ({
if (isInitialMount.current && user) {
isInitialMount.current = false;
const settings: UserProfileSettings = {
displayName: user.displayName,
displayName: user.displayName || '',
email: user.email,
currentPassword: '',
newPassword: '',
@@ -112,7 +112,7 @@ const AccountSettings: React.FC<AccountSettingsProps> = ({
// Add display name if changed
if (state.localSettings.displayName !== state.initialSettings.displayName) {
updates.displayName = state.localSettings.displayName;
updates.displayName = state.localSettings.displayName || '';
}
// Handle password change
@@ -132,10 +132,10 @@ const AccountSettings: React.FC<AccountSettingsProps> = ({
// If we're only changing display name or have password already provided, proceed directly
if (!needsPasswordConfirmation || state.localSettings.currentPassword) {
if (needsPasswordConfirmation) {
updates.email = state.localSettings.email;
updates.email = state.localSettings.email || '';
// If we don't have a password change, we still need to include the current password for email change
if (!updates.currentPassword) {
updates.currentPassword = state.localSettings.currentPassword;
updates.currentPassword = state.localSettings.currentPassword || '';
}
}

View File

@@ -4,12 +4,10 @@ import { useWorkspace } from '../../../contexts/WorkspaceContext';
import { Theme } from '@/types/theme';
interface AppearanceSettingsProps {
themeSettings?: Theme;
onThemeChange: (newTheme: Theme) => void;
}
const AppearanceSettings: React.FC<AppearanceSettingsProps> = ({
themeSettings,
onThemeChange,
}) => {
const { colorScheme, updateColorScheme } = useWorkspace();

View File

@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Box, Button, Title } from '@mantine/core';
import { Box, Button } from '@mantine/core';
import DeleteWorkspaceModal from '../../modals/workspace/DeleteWorkspaceModal';
import { useWorkspace } from '../../../contexts/WorkspaceContext';
import { useModalContext } from '../../../contexts/ModalContext';

View File

@@ -192,7 +192,6 @@ const WorkspaceSettings: React.FC = () => {
<AccordionControl>Appearance</AccordionControl>
<Accordion.Panel>
<AppearanceSettings
themeSettings={state.localSettings.theme}
onThemeChange={(newTheme: string) =>
handleInputChange('theme', newTheme)
}