Skip to content

Commit

Permalink
Merge pull request #2047 from codervinod123/main
Browse files Browse the repository at this point in the history
fit:removed % Done bar
  • Loading branch information
vinaybadgujar102 authored Sep 24, 2024
2 parents 61e8211 + 14baa29 commit 5a04208
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
59 changes: 21 additions & 38 deletions documentation/technical/PRGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions documentation/technical/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
5 changes: 4 additions & 1 deletion documentation/technical/conventions/Readme.md
Original file line number Diff line number Diff line change
@@ -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!

3 changes: 3 additions & 0 deletions documentation/technical/conventions/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -15,13 +16,15 @@ 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.
- **Interfaces and Types:** Use interfaces for objects and types for unions.
- **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.
Expand Down
3 changes: 3 additions & 0 deletions documentation/technical/conventions/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&reg;

ZinZen&reg; 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.
Expand All @@ -16,9 +16,8 @@ that can be called from the React-based UI application.

The ZinZen&reg; UI application can be found here: [ZinZen&reg; 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
Expand Down
2 changes: 1 addition & 1 deletion src/api/GoalsAPI/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const updateGoal = async (id: string, changes: Partial<GoalItem>) => {
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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/GoalsComponents/GoalsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
65 changes: 6 additions & 59 deletions src/components/MyTimeComponents/ColorBands.tsx
Original file line number Diff line number Diff line change
@@ -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<IColorBands> = ({ 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<IColorBands> = ({ list }) => {
return (
<>
<div className={`MyTime_colorPalette ${active ? "active" : ""}`}>
{(list.colorBands || []).map((ele, index) => (
<div className="colorBand" key={uuidv4()} style={{ zIndex: 30 - index, height: 10, ...ele.style }} />
))}
</div>
{active && day === "Today" && (
<>
<div className="task-progress">
<p>{`${dayTotal > 0 ? `${Math.floor((dayCompleted / dayTotal) * 100)}% done` : "No tasks today"}`}</p>
</div>
<div className={`MyTime_colorPalette ${active ? "active" : ""}`}>
{[
...completed,
{
width: "100%",
background: "#d9cccc",
},
].map((ele, index) => (
<div className="colorBand" key={uuidv4()} style={{ zIndex: 30 - index, height: 10, ...ele }} />
))}
</div>
</>
)}
</>
<div className="MyTime_colorPalette">
{(list.colorBands || []).map((ele, index) => (
<div className="colorBand" key={uuidv4()} style={{ zIndex: 30 - index, height: 10, ...ele.style }} />
))}
</div>
);
};

Expand Down
8 changes: 0 additions & 8 deletions src/components/MyTimeComponents/MyTimeline/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 7 additions & 5 deletions src/override.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,23 @@
.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;
}
}

.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;
Expand Down
11 changes: 5 additions & 6 deletions src/pages/FeedbackPage/feedbackpage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
#build-info-line p {
color: grey;
font-size: small;
}
4 changes: 0 additions & 4 deletions src/pages/MyTimePage/MyTimePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
width: calc(100vw - 15%);
}

.MyTime_colorPalette.active {
background: var(--bottom-nav-color);
}

.colorBand {
position: absolute;
left: 4%;
Expand Down
4 changes: 1 addition & 3 deletions src/pages/MyTimePage/MyTimePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ export const MyTimePage = () => {
</div>
</div>
</div>
{tasks[day] && (
<ColorBands list={tasks[day]} day={day} tasksStatus={tasksStatus} active={showTasks.includes(day)} />
)}
{tasks[day] && <ColorBands list={tasks[day]} />}
</button>
<div style={showTasks.includes(day) ? { background: "var(--bottom-nav-color)" } : {}}>
{showTasks.includes(day) && tasks[day] && tasks[day].scheduled.length > 0 && (
Expand Down
2 changes: 1 addition & 1 deletion src/utils/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 5a04208

Please sign in to comment.