Skip to content

Commit 789c966

Browse files
fix: preview sync merge conflict
2 parents 6f363ea + c07f7b7 commit 789c966

File tree

25 files changed

+639
-146
lines changed

25 files changed

+639
-146
lines changed

apps/api/plane/api/serializers/project.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Third party imports
2+
import random
23
from rest_framework import serializers
34

45
# Module imports
@@ -24,6 +25,47 @@ class ProjectCreateSerializer(BaseSerializer):
2425
and workspace association for new project initialization.
2526
"""
2627

28+
PROJECT_ICON_DEFAULT_COLORS = [
29+
"#95999f",
30+
"#6d7b8a",
31+
"#5e6ad2",
32+
"#02b5ed",
33+
"#02b55c",
34+
"#f2be02",
35+
"#e57a00",
36+
"#f38e82",
37+
]
38+
PROJECT_ICON_DEFAULT_ICONS = [
39+
"home",
40+
"apps",
41+
"settings",
42+
"star",
43+
"favorite",
44+
"done",
45+
"check_circle",
46+
"add_task",
47+
"create_new_folder",
48+
"dataset",
49+
"terminal",
50+
"key",
51+
"rocket",
52+
"public",
53+
"quiz",
54+
"mood",
55+
"gavel",
56+
"eco",
57+
"diamond",
58+
"forest",
59+
"bolt",
60+
"sync",
61+
"cached",
62+
"library_add",
63+
"view_timeline",
64+
"view_kanban",
65+
"empty_dashboard",
66+
"cycle",
67+
]
68+
2769
class Meta:
2870
model = Project
2971
fields = [
@@ -44,10 +86,10 @@ class Meta:
4486
"archive_in",
4587
"close_in",
4688
"timezone",
47-
"logo_props",
4889
"external_source",
4990
"external_id",
5091
"is_issue_type_enabled",
92+
"is_time_tracking_enabled",
5193
]
5294

5395
read_only_fields = [
@@ -57,6 +99,7 @@ class Meta:
5799
"updated_at",
58100
"created_by",
59101
"updated_by",
102+
"logo_props",
60103
]
61104

62105
def validate(self, data):
@@ -86,6 +129,16 @@ def create(self, validated_data):
86129
if ProjectIdentifier.objects.filter(name=identifier, workspace_id=self.context["workspace_id"]).exists():
87130
raise serializers.ValidationError(detail="Project Identifier is taken")
88131

132+
if validated_data.get("logo_props", None) is None:
133+
# Generate a random icon and color for the project icon
134+
validated_data["logo_props"] = {
135+
"in_use": "icon",
136+
"icon": {
137+
"name": random.choice(self.PROJECT_ICON_DEFAULT_ICONS),
138+
"color": random.choice(self.PROJECT_ICON_DEFAULT_COLORS),
139+
},
140+
}
141+
89142
project = Project.objects.create(**validated_data, workspace_id=self.context["workspace_id"])
90143
return project
91144

apps/api/plane/app/views/search/base.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -294,29 +294,15 @@ def get(self, request, slug):
294294
.order_by("-created_at")
295295
)
296296

297-
if issue_id:
298-
issue_created_by = (
299-
Issue.objects.filter(id=issue_id).values_list("created_by_id", flat=True).first()
300-
)
301-
users = (
302-
users.filter(Q(role__gt=10) | Q(member_id=issue_created_by))
303-
.distinct()
304-
.values(
305-
"member__avatar_url",
306-
"member__display_name",
307-
"member__id",
308-
)
309-
)
310-
else:
311-
users = (
312-
users.filter(Q(role__gt=10))
313-
.distinct()
314-
.values(
315-
"member__avatar_url",
316-
"member__display_name",
317-
"member__id",
318-
)
297+
users = (
298+
users
299+
.distinct()
300+
.values(
301+
"member__avatar_url",
302+
"member__display_name",
303+
"member__id",
319304
)
305+
)
320306

321307
response_data["user_mention"] = list(users[:count])
322308

apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
"use client";
22

33
import { observer } from "mobx-react";
4-
import { useParams } from "next/navigation";
4+
import { useParams, useRouter } from "next/navigation";
55
import useSWR from "swr";
66
// ui
7+
import { Banner } from "@plane/propel/banner";
8+
import { Button } from "@plane/propel/button";
9+
import { ArchiveIcon } from "@plane/propel/icons";
710
import { Loader } from "@plane/ui";
811
// components
912
import { PageHead } from "@/components/core/page-title";
@@ -16,6 +19,7 @@ import { useProject } from "@/hooks/store/use-project";
1619
const ArchivedIssueDetailsPage = observer(() => {
1720
// router
1821
const { workspaceSlug, projectId, archivedIssueId } = useParams();
22+
const router = useRouter();
1923
// states
2024
// hooks
2125
const {
@@ -62,18 +66,35 @@ const ArchivedIssueDetailsPage = observer(() => {
6266
</div>
6367
</Loader>
6468
) : (
65-
<div className="flex h-full overflow-hidden">
66-
<div className="h-full w-full space-y-3 divide-y-2 divide-custom-border-200 overflow-y-auto">
67-
{workspaceSlug && projectId && archivedIssueId && (
68-
<IssueDetailRoot
69-
workspaceSlug={workspaceSlug.toString()}
70-
projectId={projectId.toString()}
71-
issueId={archivedIssueId.toString()}
72-
is_archived
73-
/>
74-
)}
69+
<>
70+
<Banner
71+
variant="warning"
72+
title="This work item has been archived. Visit the Archives section to restore it."
73+
icon={<ArchiveIcon className="size-4" />}
74+
action={
75+
<Button
76+
variant="neutral-primary"
77+
size="sm"
78+
onClick={() => router.push(`/${workspaceSlug}/projects/${projectId}/archives/issues/`)}
79+
>
80+
Go to archives
81+
</Button>
82+
}
83+
className="border-b border-custom-border-200"
84+
/>
85+
<div className="flex h-full overflow-hidden">
86+
<div className="h-full w-full space-y-3 divide-y-2 divide-custom-border-200 overflow-y-auto">
87+
{workspaceSlug && projectId && archivedIssueId && (
88+
<IssueDetailRoot
89+
workspaceSlug={workspaceSlug.toString()}
90+
projectId={projectId.toString()}
91+
issueId={archivedIssueId.toString()}
92+
is_archived
93+
/>
94+
)}
95+
</div>
7596
</div>
76-
</div>
97+
</>
7798
)}
7899
</>
79100
);

apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/mobile-header.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"use client";
22

3+
import type React from "react";
34
import type React from "react";
45
import { observer } from "mobx-react";
56
// ui
7+
import type { ISvgIcons } from "@plane/propel/icons";
68
import { TimelineLayoutIcon, GridLayoutIcon, ListLayoutIcon } from "@plane/propel/icons";
79
// plane package imports
810
import type { TCycleLayoutOptions } from "@plane/types";
@@ -13,7 +15,7 @@ import { useProject } from "@/hooks/store/use-project";
1315

1416
const CYCLE_VIEW_LAYOUTS: {
1517
key: TCycleLayoutOptions;
16-
icon: React.FC<React.SVGProps<SVGSVGElement>>;
18+
icon: React.FC<ISvgIcons>;
1719
title: string;
1820
}[] = [
1921
{

apps/web/core/components/issues/issue-layouts/properties/labels.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
101101
fullWidth && "w-full"
102102
)}
103103
>
104-
<LabelPropertyIcon className="h-3.5 w-3.5" strokeWidth={2} />
104+
<LabelPropertyIcon className="h-3.5 w-3.5" />
105105
{placeholderText}
106106
</div>
107107
</Tooltip>

packages/propel/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"import": "./dist/avatar/index.mjs",
2929
"require": "./dist/avatar/index.js"
3030
},
31+
"./banner": {
32+
"import": "./dist/banner/index.mjs",
33+
"require": "./dist/banner/index.js"
34+
},
3135
"./button": {
3236
"import": "./dist/button/index.mjs",
3337
"require": "./dist/button/index.js"

0 commit comments

Comments
 (0)