Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Thank you for your interest in contributing to DocuGen! This document provides g
- Node.js 18+
- npm 9+
- Git
- ESLint 9+ (for local development, ESLint uses flat config)

### Development Setup

Expand Down
44 changes: 20 additions & 24 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';

const browserGlobals = {
window: 'readonly',
document: 'readonly',
console: 'readonly',
localStorage: 'readonly',
navigator: 'readonly',
setTimeout: 'readonly',
File: 'readonly',
Element: 'readonly',
HTMLInputElement: 'readonly',
React: 'readonly',
};

export default [
js.configs.recommended,
{
Expand Down Expand Up @@ -33,21 +47,9 @@
},
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
localStorage: 'readonly',
navigator: 'readonly',
setTimeout: 'readonly',
File: 'readonly',
Element: 'readonly',
HTMLInputElement: 'readonly',
React: 'readonly',
...browserGlobals,
},
},
rules: {
'no-unused-vars': 'warn',
},
},
{
files: ['**/*.{ts,tsx}'],
Expand All @@ -61,26 +63,20 @@
},
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
localStorage: 'readonly',
navigator: 'readonly',
setTimeout: 'readonly',
File: 'readonly',
Element: 'readonly',
HTMLInputElement: 'readonly',
React: 'readonly',
...browserGlobals,
},
},
plugins: {
'@typescript-eslint': typescript,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...typescript.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
...reactHooks.configs.recommended.rules,
Comment thread
shazzar00ni marked this conversation as resolved.
Outdated
},
},
];
14 changes: 5 additions & 9 deletions src/components/CookieConsent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import { Button } from './ui/Button';

Expand All @@ -10,18 +10,14 @@ import { Button } from './ui/Button';
* @returns Cookie consent banner component
*/
export function CookieConsent() {
const [showConsent, setShowConsent] = useState(false);

useEffect(() => {
const [showConsent, setShowConsent] = useState(() => {
try {
const hasConsented = localStorage.getItem('docugen-cookie-consent');
if (!hasConsented) {
setShowConsent(true);
}
return !hasConsented;
} catch {
setShowConsent(true);
return true;
}
}, []);
});

/**
* Handles accepting all cookies.
Expand Down
26 changes: 13 additions & 13 deletions src/components/UploadDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ export function UploadDemo() {
const [isComplete, setIsComplete] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);

/**
* Simulates the file upload process with a 2-second delay.
* Sets uploading state to true immediately, then transitions to complete state after timeout.
* Provides visual feedback during the upload process with progress indication.
*/
const simulateUpload = () => {
setIsUploading(true);
setTimeout(() => {
setIsUploading(false);
setIsComplete(true);
}, 2000);
};

/**
* Handles the drag over event for the dropzone.
* Prevents default browser behavior and sets the dragging state to true
Expand Down Expand Up @@ -81,19 +94,6 @@ export function UploadDemo() {
}
}, []);

/**
* Simulates the file upload process with a 2-second delay.
* Sets uploading state to true immediately, then transitions to complete state after timeout.
* Provides visual feedback during the upload process with progress indication.
*/
const simulateUpload = () => {
setIsUploading(true);
setTimeout(() => {
setIsUploading(false);
setIsComplete(true);
}, 2000);
};

/**
* Resets the upload demo to its initial state.
* Clears the selected file and resets all state variables to allow for new uploads.
Expand Down
14 changes: 6 additions & 8 deletions src/lib/ThemeContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, useEffect, useState, type ReactNode } from 'react';
import { createContext, useState, type ReactNode } from 'react';

export type Theme = 'dark' | 'light';

Expand Down Expand Up @@ -71,13 +71,11 @@ interface ThemeProviderProps {
* ```
*/
export function ThemeProvider({ children }: ThemeProviderProps) {
const [theme, setTheme] = useState<Theme>('dark');

useEffect(() => {
const initialTheme = getInitialTheme();
setTheme(initialTheme);
applyTheme(initialTheme);
}, []);
const [theme, setTheme] = useState<Theme>(() => {
const initial = getInitialTheme();
applyTheme(initial);
return initial;
});
Comment thread
shazzar00ni marked this conversation as resolved.
Outdated

const toggleTheme = () => {
const newTheme = theme === 'dark' ? 'light' : 'dark';
Expand Down
Loading