diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index ce4acbc0b..fa6482a5d 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -4,7 +4,7 @@ Resolves # - [x] The PR title is of form 'issue_title #issue_number' - [x] If no issue is referenced, my changes are simple and summarized in title - and in max three sentences in the description. - If not please make an issue - so need for change is validated. + If not please make an issue - so need for change is validated. - [x] I'll be patient as I understand responses can take days. - [x] I have formatted according to project guidelines. - [x] I have not introduced any new failing lints or tests. diff --git a/documentation/technical/PRGuide.md b/documentation/technical/PRGuide.md index 6d88db769..922f36967 100644 --- a/documentation/technical/PRGuide.md +++ b/documentation/technical/PRGuide.md @@ -9,37 +9,26 @@ Follow these simple steps to propose changes or fixes to ZinZen: ### Keep Your Repositories in Sync 1. Before starting any work, make sure your local project matches ZinZen's latest version: - - Switch to your local project's main branch: - - `git checkout main` - - - Get the latest changes from ZinZen's repository (without merging them into your main branch): - - `git fetch upstream` - - - Merge these changes into your main branch: - - `git merge upstream/main` - - - Update your GitHub repository (origin) with these changes: - - `git push origin main` - + - Switch to your local project's main branch: + `git checkout main` + - Get the latest changes from ZinZen's repository (without merging them into your main branch): + `git fetch upstream` + - Merge these changes into your main branch: + `git merge upstream/main` + - Update your GitHub repository (origin) with these changes: + `git push origin main` ### Setup a feature branch -1. Make a new branch in your local project for your fixes or features (called a "feature branch"). +1. Make a new branch in your local project for your fixes or features (called a "feature branch"). 2. Follow [branch naming conventions](./conventions/git.md): `[developer shortcut]/[issue number]/[meaningful name]` - - To create and switch to a new branch locally: - - `git checkout -b vin/01/my-fix-branch` - - - Push this branch to your GitHub repository: - - `git push origin vin/01/my-fix-branch` - + + - To create and switch to a new branch locally: + `git checkout -b vin/01/my-fix-branch` + - Push this branch to your GitHub repository: + `git push origin vin/01/my-fix-branch` ### Work on Your Changes @@ -87,19 +76,13 @@ ZinZen's main branch must always be error-free. Pull requests that fail tests or If your pull request receives feedback, make more commits to your branch and push them to your GitHub repository. They'll be added to the pull request automatically. Follow these steps: 1. Update your local repository: - - Switch to the correct branch: - - `git checkout vin/01/my-fix-branch` - - - Get changes from ZinZen: - - `git pull --rebase upstream main` - - - Make the required changes in your branch. - - Once satisfied, push them to your GitHub repository to update your pull request: - - `git push origin vin/01/my-fix-branch` - + - Switch to the correct branch: + `git checkout vin/01/my-fix-branch` + - Get changes from ZinZen: + `git pull --rebase upstream main` + - Make the required changes in your branch. + - Once satisfied, push them to your GitHub repository to update your pull request: + `git push origin vin/01/my-fix-branch` Repeat this process until your changes are accepted and merged. diff --git a/documentation/technical/Setup.md b/documentation/technical/Setup.md index eaf0aff73..b5b56e97e 100644 --- a/documentation/technical/Setup.md +++ b/documentation/technical/Setup.md @@ -9,10 +9,12 @@ The steps outlined in this section are a one-time process necessary for contribu Here's how to establish and maintain a fork of ZinZen and make periodic contributions: 1. **Fork ZinZen:** + - To begin, create a fork of the [ZinZen repository](https://github.com/tijlleenders/ZinZen) on GitHub. - Click the "Fork" button and choose a suitable GitHub account, such as your personal GitHub account, for the fork. 2. **Clone Your Fork:** + - Access your GitHub account and go to your Fork of ZinZen. - Click on the "<> Code" tab located in the upper left corner. - Within the dropdown menu that appears, select "HTTPS" (you can choose SSH if preferred, but this tutorial uses HTTPS for simplicity). diff --git a/documentation/technical/conventions/Readme.md b/documentation/technical/conventions/Readme.md index 42ccf4446..6172d18e7 100644 --- a/documentation/technical/conventions/Readme.md +++ b/documentation/technical/conventions/Readme.md @@ -1,14 +1,17 @@ # Getting Started + Before you start contributing to the ZinZen project, it's important to familiarize yourself with our conventions and workflows. This ensures a smooth and consistent development process for everyone involved. ### Code Conventions + Our [Code Conventions](code.md) document outlines the coding standards, naming conventions, and best practices for maintaining code quality and readability. It's crucial to adhere to these guidelines to ensure consistency across the codebase. ### Git Conventions + The [Git Conventions](git.md) document provides detailed instructions on the commit process, branching strategy, and pull request guidelines. Following these conventions is essential for efficient collaboration and code integration. ## Contributing + We welcome contributions from everyone! Please read our contributing guidelines to understand how you can contribute effectively. If you have any questions, feel free to open an issue for discussion. Thank you for being a part of the ZinZen project! - diff --git a/documentation/technical/conventions/code.md b/documentation/technical/conventions/code.md index d863906df..516447d8e 100644 --- a/documentation/technical/conventions/code.md +++ b/documentation/technical/conventions/code.md @@ -3,6 +3,7 @@ This document provides a set of coding standards and best practices for contributing to the ZinZen project. It aims to ensure consistency, readability, and maintainability of the codebase. ### Naming Conventions + Proper naming enhances code readability: - **General:** Use clear, descriptive names. @@ -15,6 +16,7 @@ Proper naming enhances code readability: - **Type Names:** Use PascalCase (e.g., `User`). ### TypeScript Practices + Follow these TypeScript-specific practices: - **Type Annotations:** Always use type annotations. @@ -22,6 +24,7 @@ Follow these TypeScript-specific practices: - **Avoid `any`:** Minimize the use of `any` for better type checking. ### Code Quality and Robustness + To ensure the reliability and maintainability of the code: - **Simplicity:** Write simple and clear code. diff --git a/documentation/technical/conventions/git.md b/documentation/technical/conventions/git.md index 3998552a9..b3f907b31 100644 --- a/documentation/technical/conventions/git.md +++ b/documentation/technical/conventions/git.md @@ -3,15 +3,18 @@ Before merging code into the main branch, it undergoes a thorough peer review to ensure quality and readiness for deployment. Your code submissions should be crafted for clarity and ease of review. ## Committing Process + - **Small Commits:** Make commits small and logical, easy to understand and follow. - **Review Before Committing:** Before committing, review each file for temporary or test code, warnings, formatting issues, and unnecessary packages. - **Frequent Commits:** Commit often to track progress and create a transparent history of your work. - **Early Pull Requests:** Make PRs as soon as possible to integrate changes quickly and reduce conflicts. ## Before Pushing Your Code + - **No Warnings:** Ensure there are no warnings in your code. The development and main branches should be free of warnings to make it easier to spot new issues introduced by recent code changes. ## Branching Convention + - **Naming Format:** Use the format `[developer shortcut]/[issue number]/[meaningful name]`, like `alice/411/fix-budgets-on-weekends`. - **Developer Specific:** Branches should be developed by the assigned developer only to maintain clarity in the development process. - **Merging and Deletion:** Once finished, branches should be merged into the main branch after PR review and then deleted. diff --git a/pkg/README.md b/pkg/README.md index 28456759c..973a2e551 100644 --- a/pkg/README.md +++ b/pkg/README.md @@ -5,8 +5,8 @@ can talk big-O, add features or optimize hot loops. > Please contact me tijl@zinzen.me or open an issue. - ## ZinZen® + ZinZen® is a platform for stress-free life planning. It works by defining life goals with constraints and dependencies. An automatic scheduler then schedules tasks in a calendar to reach these goals, auto-magically updating the schedule when goals or constraints change. @@ -16,9 +16,8 @@ that can be called from the React-based UI application. The ZinZen® UI application can be found here: [ZinZen® Github](https://github.com/tijlleenders/ZinZen) - - ## Getting started + All documentation can be found in the folder [documentation](documentation/Readme.md). In this folder you will find a [technical know-how base](documentation/technical/Readme.md), as well as all the necessary [functional documentation](documentation/functional/Readme.md) to understand the diff --git a/src/api/GoalsAPI/index.ts b/src/api/GoalsAPI/index.ts index dc4d53417..c3f13164e 100644 --- a/src/api/GoalsAPI/index.ts +++ b/src/api/GoalsAPI/index.ts @@ -91,7 +91,7 @@ export const updateGoal = async (id: string, changes: Partial) => { await db .transaction("rw", db.goalsCollection, async () => { await db.goalsCollection.update(id, changes).then((updated) => { - updateStatus = updated === 1 ? true : false; + updateStatus = updated === 1; }); }) .catch((e) => { diff --git a/src/components/GoalsComponents/GoalsList.tsx b/src/components/GoalsComponents/GoalsList.tsx index e7f237ee8..9a0b1cf54 100644 --- a/src/components/GoalsComponents/GoalsList.tsx +++ b/src/components/GoalsComponents/GoalsList.tsx @@ -15,7 +15,7 @@ import { useRecoilValue } from "recoil"; import { impossibleGoalsList } from "@src/store/ImpossibleGoalState"; import { ImpossibleGoal } from "@src/Interfaces"; import { useGoalSelection } from "@src/hooks/useGoalSelection"; - + import SortableItem from "./MyGoal/SortableItem"; interface GoalsListProps { diff --git a/src/components/GoalsComponents/MyGoal/components/GoalDropdown.tsx b/src/components/GoalsComponents/MyGoal/components/GoalDropdown.tsx index f8f691f4f..14f755392 100644 --- a/src/components/GoalsComponents/MyGoal/components/GoalDropdown.tsx +++ b/src/components/GoalsComponents/MyGoal/components/GoalDropdown.tsx @@ -1,9 +1,9 @@ import React from "react"; import NotificationSymbol from "@src/common/NotificationSymbol"; import { GoalItem } from "@src/models/GoalItem"; -import TriangleIcon from "../../../../assets/TriangleIcon"; import CopyIcon from "@src/assets/CopyIcon"; import { isGoalCode } from "@src/utils/patterns"; +import TriangleIcon from "../../../../assets/TriangleIcon"; interface GoalDropdownProps { goal: GoalItem; diff --git a/src/components/MyTimeComponents/ColorBands.tsx b/src/components/MyTimeComponents/ColorBands.tsx index 6875f08fb..2feeb5852 100644 --- a/src/components/MyTimeComponents/ColorBands.tsx +++ b/src/components/MyTimeComponents/ColorBands.tsx @@ -1,71 +1,18 @@ -import { ITaskProgress } from "@src/Interfaces/IPages"; import { ITaskOfDay } from "@src/Interfaces/Task"; -import { TaskItem } from "@src/models/TaskItem"; import React from "react"; import { v4 as uuidv4 } from "uuid"; interface IColorBands { - tasksStatus: { - [goalId: string]: TaskItem; - }; - active: boolean; list: ITaskOfDay; - day: string; } -const ColorBands: React.FC = ({ list, tasksStatus, day, active }) => { - let dayCompleted = 0; - let dayTotal = 0; - const taskProgress: ITaskProgress = {}; - const completion: { [goalId: string]: number } = {}; - list.scheduled.forEach((ele) => { - const { goalid } = ele; - if (!taskProgress[goalid]) { - const completedToday = tasksStatus[goalid]?.completedToday || 0; - dayCompleted += completedToday; - completion[goalid] = completedToday + (completion[goalid] || 0); - taskProgress[goalid] = { total: 0, completed: completedToday, goalColor: ele.goalColor }; - } - taskProgress[goalid].total += ele.duration; - dayTotal += ele.duration; - }); - - const completed: React.CSSProperties[] = []; - let acc = 0; - [...(list.colorBands || [])].forEach((ele) => { - const customStyle = { ...ele.style }; - if (completion[ele.goalId]) { - acc += ele.duration; - completion[ele.goalId] -= ele.duration; - completed.push({ ...customStyle, width: `${(acc / 24) * 100}%` }); - } - }); +const ColorBands: React.FC = ({ list }) => { return ( - <> -
- {(list.colorBands || []).map((ele, index) => ( -
- ))} -
- {active && day === "Today" && ( - <> -
-

{`${dayTotal > 0 ? `${Math.floor((dayCompleted / dayTotal) * 100)}% done` : "No tasks today"}`}

-
-
- {[ - ...completed, - { - width: "100%", - background: "#d9cccc", - }, - ].map((ele, index) => ( -
- ))} -
- - )} - +
+ {(list.colorBands || []).map((ele, index) => ( +
+ ))} +
); }; diff --git a/src/components/MyTimeComponents/MyTimeline/index.scss b/src/components/MyTimeComponents/MyTimeline/index.scss index f113049ae..1d93a5b49 100644 --- a/src/components/MyTimeComponents/MyTimeline/index.scss +++ b/src/components/MyTimeComponents/MyTimeline/index.scss @@ -131,11 +131,3 @@ transition: opacity 0.5s ease-out; } -.task-progress { - display: flex; - justify-content: flex-end; - padding-right: 3%; - padding-top: 12px; - font-weight: 400; - font-size: 0.875em; -} diff --git a/src/override.scss b/src/override.scss index 2c8a7da6f..185b63239 100644 --- a/src/override.scss +++ b/src/override.scss @@ -102,12 +102,15 @@ .ant-switch-dark { background: #8c8c8c !important; } -.ant-switch:hover:not(.ant-switch-disabled), .ant-switch-dark:hover:not(.ant-switch-dark-disabled) { +.ant-switch:hover:not(.ant-switch-disabled), +.ant-switch-dark:hover:not(.ant-switch-dark-disabled) { background: #8c8c8c !important; } -.ant-switch-checked, .ant-switch-dark-checked { - .ant-switch-inner, .ant-switch-dark-inner { +.ant-switch-checked, +.ant-switch-dark-checked { + .ant-switch-inner, + .ant-switch-dark-inner { background: var(--selection-color) !important; } } @@ -115,8 +118,7 @@ .ant-switch-inner-checked, .ant-switch-inner-unchecked, .ant-switch-dark-inner-checked, -.ant-switch-dark-inner-unchecked - { +.ant-switch-dark-inner-unchecked { img { width: 15px; height: 15px; diff --git a/src/pages/FeedbackPage/feedbackpage.scss b/src/pages/FeedbackPage/feedbackpage.scss index 92bb777ca..fe00bae66 100644 --- a/src/pages/FeedbackPage/feedbackpage.scss +++ b/src/pages/FeedbackPage/feedbackpage.scss @@ -49,11 +49,10 @@ padding: 8px 16px; background-color: var(--selection-color); } -#build-info-line{ +#build-info-line { margin-top: 20px; } -#build-info-line p{ - color:grey; - font-size: small; - -} \ No newline at end of file +#build-info-line p { + color: grey; + font-size: small; +} diff --git a/src/pages/MyTimePage/MyTimePage.scss b/src/pages/MyTimePage/MyTimePage.scss index 6cfb3019b..67b4e759e 100644 --- a/src/pages/MyTimePage/MyTimePage.scss +++ b/src/pages/MyTimePage/MyTimePage.scss @@ -40,10 +40,6 @@ width: calc(100vw - 15%); } -.MyTime_colorPalette.active { - background: var(--bottom-nav-color); -} - .colorBand { position: absolute; left: 4%; diff --git a/src/pages/MyTimePage/MyTimePage.tsx b/src/pages/MyTimePage/MyTimePage.tsx index ad246fb27..7c4890f1b 100644 --- a/src/pages/MyTimePage/MyTimePage.tsx +++ b/src/pages/MyTimePage/MyTimePage.tsx @@ -68,9 +68,7 @@ export const MyTimePage = () => {
- {tasks[day] && ( - - )} + {tasks[day] && }
{showTasks.includes(day) && tasks[day] && tasks[day].scheduled.length > 0 && ( diff --git a/src/utils/patterns.ts b/src/utils/patterns.ts index 53e4055db..c048eafc8 100644 --- a/src/utils/patterns.ts +++ b/src/utils/patterns.ts @@ -39,7 +39,7 @@ export function isJSONParsable(str: string | null | undefined): boolean { } export const extractLinks = (text: string) => { - let regex = /([\w+]+\:\/\/)?([\w\d-]+\.)*[\w-]+[\.\:]\w+([\/\?\=\&\#\.]?[\w-]+)*\/?/gm; + const regex = /([\w+]+\:\/\/)?([\w\d-]+\.)*[\w-]+[\.\:]\w+([\/\?\=\&\#\.]?[\w-]+)*\/?/gm; const matches = text.match(regex); return matches ? matches[0] : null; };