Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-1424] chore: page and view logo implementation, and emoji/icon picker improvement #4583

Merged
merged 36 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3be85cd
chore: added logo_props
NarayanBavisetti May 15, 2024
31fd451
Merge branch 'chore/project-page-list-improvement' of github.com:make…
anmolsinghbhatia May 21, 2024
2038a87
chore: logo props in cycles, views and modules
NarayanBavisetti May 22, 2024
47232aa
Merge branch 'chore/project-page-list-improvement' of github.com:make…
anmolsinghbhatia May 23, 2024
3113422
Merge branch 'preview' of github.com:makeplane/plane into chore/proje…
anmolsinghbhatia May 23, 2024
b5f3879
Merge branch 'preview' of github.com:makeplane/plane into chore/proje…
anmolsinghbhatia May 23, 2024
d507690
Merge branch 'preview' of github.com:makeplane/plane into chore/proje…
anmolsinghbhatia May 24, 2024
200d307
chore: emoji icon picker types updated
anmolsinghbhatia May 24, 2024
33e39ba
chore: info icon added to plane ui package
anmolsinghbhatia May 24, 2024
74ff8b0
chore: icon color adjust helper function added
anmolsinghbhatia May 24, 2024
2892ca1
style: icon picker ui improvement and default color options updated
anmolsinghbhatia May 24, 2024
bc361d9
chore: update page logo action added in store
anmolsinghbhatia May 24, 2024
a1e8c40
chore: emoji code to unicode helper function added
anmolsinghbhatia May 24, 2024
c542b33
chore: common logo renderer component added
anmolsinghbhatia May 24, 2024
9982946
chore: app header project logo updated
anmolsinghbhatia May 24, 2024
97ac6d3
chore: project logo updated across platform
anmolsinghbhatia May 24, 2024
ae87a5e
chore: page logo picker added
anmolsinghbhatia May 24, 2024
5715ef1
chore: control link component improvement
anmolsinghbhatia May 24, 2024
0c0f0e1
chore: list item improvement
anmolsinghbhatia May 24, 2024
b85e995
chore: emoji picker component updated
anmolsinghbhatia May 24, 2024
f911f11
chore: space app and package logo prop type updated
anmolsinghbhatia May 24, 2024
e6b56d6
chore: migration
anmolsinghbhatia May 24, 2024
fc3a4e7
chore: logo added to project view
anmolsinghbhatia May 24, 2024
14e5cd0
chore: merge conflict resolved
anmolsinghbhatia May 24, 2024
1ca5b62
chore: page logo picker added in create modal and breadcrumbs
anmolsinghbhatia May 27, 2024
97c28bd
chore: view logo picker added in create modal and updated breadcrumbs
anmolsinghbhatia May 27, 2024
9e210f5
Merge branch 'preview' of github.com:makeplane/plane into chore/proje…
anmolsinghbhatia May 27, 2024
8790a53
fix: build error
anmolsinghbhatia May 27, 2024
83bd85f
chore: AIO docker images for preview deployments (#4605)
mguptahub May 28, 2024
f193472
Merge branch 'develop' of github.com:makeplane/plane into chore/proje…
anmolsinghbhatia May 28, 2024
5a222ef
fix: merge conflict
anmolsinghbhatia May 28, 2024
d9191c4
chore: lucide react added to planu ui package
anmolsinghbhatia May 29, 2024
7c5ce74
chore: new emoji picker component added with lucid icon and code refa…
anmolsinghbhatia May 29, 2024
3e942b9
chore: logo component updated
anmolsinghbhatia May 29, 2024
36cc5bf
chore: emoji picker updated for pages and views
anmolsinghbhatia May 29, 2024
44e8465
resolve merge conflict
anmolsinghbhatia May 29, 2024
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
1 change: 1 addition & 0 deletions apiserver/plane/app/serializers/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Meta:
"external_source",
"external_id",
"progress_snapshot",
"logo_props",
# meta fields
"is_favorite",
"total_issues",
Expand Down
1 change: 1 addition & 0 deletions apiserver/plane/app/serializers/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class Meta:
"sort_order",
"external_source",
"external_id",
"logo_props",
# computed fields
"is_favorite",
"total_issues",
Expand Down
1 change: 1 addition & 0 deletions apiserver/plane/app/serializers/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Meta:
"created_by",
"updated_by",
"view_props",
"logo_props",
]
read_only_fields = [
"workspace",
Expand Down
5 changes: 5 additions & 0 deletions apiserver/plane/app/views/cycle/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def list(self, request, slug, project_id):
"external_source",
"external_id",
"progress_snapshot",
"logo_props",
# meta fields
"is_favorite",
"total_issues",
Expand Down Expand Up @@ -356,6 +357,7 @@ def list(self, request, slug, project_id):
"external_source",
"external_id",
"progress_snapshot",
"logo_props",
# meta fields
"is_favorite",
"total_issues",
Expand Down Expand Up @@ -403,6 +405,7 @@ def create(self, request, slug, project_id):
"external_source",
"external_id",
"progress_snapshot",
"logo_props",
# meta fields
"is_favorite",
"cancelled_issues",
Expand Down Expand Up @@ -496,6 +499,7 @@ def partial_update(self, request, slug, project_id, pk):
"external_source",
"external_id",
"progress_snapshot",
"logo_props",
# meta fields
"is_favorite",
"total_issues",
Expand Down Expand Up @@ -556,6 +560,7 @@ def retrieve(self, request, slug, project_id, pk):
"external_id",
"progress_snapshot",
"sub_issues",
"logo_props",
# meta fields
"is_favorite",
"total_issues",
Expand Down
3 changes: 3 additions & 0 deletions apiserver/plane/app/views/module/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def create(self, request, slug, project_id):
"sort_order",
"external_source",
"external_id",
"logo_props",
# computed fields
"is_favorite",
"cancelled_issues",
Expand Down Expand Up @@ -281,6 +282,7 @@ def list(self, request, slug, project_id):
"sort_order",
"external_source",
"external_id",
"logo_props",
# computed fields
"total_issues",
"is_favorite",
Expand Down Expand Up @@ -465,6 +467,7 @@ def partial_update(self, request, slug, project_id, pk):
"sort_order",
"external_source",
"external_id",
"logo_props",
# computed fields
"is_favorite",
"cancelled_issues",
Expand Down
12 changes: 12 additions & 0 deletions packages/types/src/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ export type TPaginationInfo = {
per_page?: number;
total_results: number;
};

export type TLogoProps = {
in_use: "emoji" | "icon";
emoji?: {
value?: string;
url?: string;
};
icon?: {
name?: string;
color?: string;
};
};
2 changes: 2 additions & 0 deletions packages/types/src/pages.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TLogoProps } from "./common";
import { EPageAccess } from "./enums";

export type TPage = {
Expand All @@ -17,6 +18,7 @@ export type TPage = {
updated_at: Date | undefined;
updated_by: string | undefined;
workspace: string | undefined;
logo_props: TLogoProps | undefined;
};

// page filters
Expand Down
15 changes: 2 additions & 13 deletions packages/types/src/project/projects.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ import type {
IUserMemberLite,
IWorkspace,
IWorkspaceLite,
TLogoProps,
TStateGroups,
} from "..";

export type TProjectLogoProps = {
in_use: "emoji" | "icon";
emoji?: {
value?: string;
url?: string;
};
icon?: {
name?: string;
color?: string;
};
};

export interface IProject {
archive_in: number;
archived_at: string | null;
Expand All @@ -46,7 +35,7 @@ export interface IProject {
is_deployed: boolean;
is_favorite: boolean;
is_member: boolean;
logo_props: TProjectLogoProps;
logo_props: TLogoProps;
member_role: EUserProjectRoles | null;
members: IProjectMemberLite[];
name: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/views.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TLogoProps } from "./common";
import {
IIssueDisplayFilterOptions,
IIssueDisplayProperties,
Expand All @@ -21,4 +22,5 @@ export interface IProjectView {
query_data: IIssueFilterOptions;
project: string;
workspace: string;
logo_props: TLogoProps | undefined;
}
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@popperjs/core": "^2.11.8",
"clsx": "^2.0.0",
"emoji-picker-react": "^4.5.16",
"lucide-react": "^0.379.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-popper": "^2.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/control-link/control-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";

export type TControlLink = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
href: string;
onClick: () => void;
onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;
children: React.ReactNode;
target?: string;
disabled?: boolean;
Expand All @@ -17,7 +17,7 @@ export const ControlLink = React.forwardRef<HTMLAnchorElement, TControlLink>((pr
const clickCondition = (event.metaKey || event.ctrlKey) && event.button === LEFT_CLICK_EVENT_CODE;
if (!clickCondition) {
event.preventDefault();
onClick();
onClick(event);
}
};

Expand Down
100 changes: 100 additions & 0 deletions packages/ui/src/emoji/emoji-icon-helper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { Placement } from "@popperjs/core";
import { EmojiClickData, Theme } from "emoji-picker-react";

export enum EmojiIconPickerTypes {
EMOJI = "emoji",
ICON = "icon",
}

export const TABS_LIST = [
{
key: EmojiIconPickerTypes.EMOJI,
title: "Emojis",
},
{
key: EmojiIconPickerTypes.ICON,
title: "Icons",
},
];

export type TChangeHandlerProps =
| {
type: EmojiIconPickerTypes.EMOJI;
value: EmojiClickData;
}
| {
type: EmojiIconPickerTypes.ICON;
value: {
name: string;
color: string;
};
};

export type TCustomEmojiPicker = {
isOpen: boolean;
handleToggle: (value: boolean) => void;
buttonClassName?: string;
className?: string;
closeOnSelect?: boolean;
defaultIconColor?: string;
defaultOpen?: EmojiIconPickerTypes;
disabled?: boolean;
dropdownClassName?: string;
label: React.ReactNode;
onChange: (value: TChangeHandlerProps) => void;
placement?: Placement;
searchPlaceholder?: string;
theme?: Theme;
iconType?: "material" | "lucide";
};

export const DEFAULT_COLORS = ["#95999f", "#6d7b8a", "#5e6ad2", "#02b5ed", "#02b55c", "#f2be02", "#e57a00", "#f38e82"];

export type TIconsListProps = {
defaultColor: string;
onChange: (val: { name: string; color: string }) => void;
};

/**
* Adjusts the given hex color to ensure it has enough contrast.
* @param {string} hex - The hex color code input by the user.
* @returns {string} - The adjusted hex color code.
*/
export const adjustColorForContrast = (hex: string): string => {
// Ensure hex color is valid
if (!/^#([0-9A-F]{3}){1,2}$/i.test(hex)) {
throw new Error("Invalid hex color code");
}

// Convert hex to RGB
let r = 0,
g = 0,
b = 0;
if (hex.length === 4) {
r = parseInt(hex[1] + hex[1], 16);
g = parseInt(hex[2] + hex[2], 16);
b = parseInt(hex[3] + hex[3], 16);
} else if (hex.length === 7) {
r = parseInt(hex[1] + hex[2], 16);
g = parseInt(hex[3] + hex[4], 16);
b = parseInt(hex[5] + hex[6], 16);
}

// Calculate luminance
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;

// If the color is too light, darken it
if (luminance > 0.5) {
r = Math.max(0, r - 50);
g = Math.max(0, g - 50);
b = Math.max(0, b - 50);
}

// Convert RGB back to hex
const toHex = (value: number): string => {
const hex = value.toString(16);
return hex.length === 1 ? "0" + hex : hex;
};

return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
};
Loading
Loading