How ischerba32/innowise-lab-internship-level-2-mini-paint works
Project Type & Core Purpose
• The project is a single-page application (SPA) built with React. Its purpose is to provide a mini “paint” or drawing application that allows users to create and manage images.
• It uses a modern stack with TypeScript, Redux Toolkit, Redux-Saga for async logic, and Firebase for authentication, the real-time database, and storage. It also leverages various UI and utility libraries like Sass, Moment, React Router, and others.
File Structure
• The top-level directories include configuration files (e.g., .eslintrc, .prettierrc), public (static assets and the initial HTML file), and src (all of the application’s code).
• Under src, components are clearly segregated into functional UI pieces:
◦ “AuthForm”, “AuthRoute” – for authentication related UI.
◦ “CanvasMenu”, “Header”, etc. – to support the drawing and layout.
◦ “Images” directory with subcomponents “ImageItem” and “ImagesList” for handling image-related views.
◦ “UI” folder contains stateless, reusable components such as Button, Card, Input, Loader, and ThemeSwitch.
• The redux folder contains slices (reducers and actions), as well as sagas (for images and user async handling), showing usage of a centralized state management system.
• Other directories like config, helpers, hooks, interfaces, and styles support modular application functionalities (e.g., Firebase integration, custom hooks, type definitions, and global styles).
Key Architectural Components
a. Frontend Presentation Layer:
• Pages: Home, Canvas, SignIn, SignUp.
• Components: Authentication components (AuthForm, AuthRoute), Header, CanvasMenu, Images components, and the collection of UI components.
b. State Management Layer:
• Redux Store: Highlight the slices (canvasSlice, imagesSlice, menuSlice, themeSlice, userSlice) that manage the application state.
• Redux Sagas: Separate sagas handling asynchronous operations for images and user activities.
• Interaction Flow: Show how UI components dispatch actions that flow into the Redux store, which in turn notifies components about state updates.
c. External Services:
• Firebase: Include the Firebase config component for authentication (via Firebase Auth), Realtime Database, and Storage (for saving images). Illustrate the data flow between Firebase and Redux (for instance, fetching user details and images).
d. Helper/Utility Layer:
• Custom hooks (useDraw, useTheme) that abstract common functionality (drawing on the canvas, theme management).
• Helpers for drawing figures, date formatting, and option selection.
Relationships & Interactions
• The static public folder contains the base index.html that bootstraps the React application; this is the root entry point.
Important Architectural Patterns & Design Principles
• Separation of Concerns: The project cleanly separates presentation (React components), business state logic (Redux slices and sagas), and external data handling (Firebase).
• Component-based Architecture: Every UI piece is encapsulated in its own folder with clear boundaries (component logic in index.tsx, typings in props.ts, and styling in a module SCSS file).
• Unidirectional Data Flow: The communication between components and state follows a unidirectional pattern (dispatch → Redux store → state update → UI render).
• Modular and Scalable Structure: The clear segregation of pages, reusable UI components, and state management logic shows an emphasis on maintainability and scalability.