Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: new sticky color + recent sticky api call + sticky max height (#6438)

Akshita Goyal0f7bc6979f54
diff --git a/web/core/components/stickies/sticky/inputs.tsx b/web/core/components/stickies/sticky/inputs.tsx
index b3a81cd6cc..0aef502a10 100644
--- a/web/core/components/stickies/sticky/inputs.tsx
+++ b/web/core/components/stickies/sticky/inputs.tsx
@@ -12,7 +12,7 @@ import { useWorkspace } from "@/hooks/store";
import { StickyEditor } from "../../editor";
type TProps = {
- stickyData: TSticky | undefined;
+ stickyData: Partial<TSticky> | undefined;
workspaceSlug: string;
handleUpdate: (payload: Partial<TSticky>) => void;
stickyId: string | undefined;
diff --git a/web/core/components/stickies/sticky/root.tsx b/web/core/components/stickies/sticky/root.tsx
index bee67f913c..50605184b4 100644
--- a/web/core/components/stickies/sticky/root.tsx
+++ b/web/core/components/stickies/sticky/root.tsx
@@ -12,7 +12,7 @@ import { useSticky } from "@/hooks/use-stickies";
import { STICKY_COLORS_LIST } from "../../editor/sticky-editor/color-palette";
import { StickyDeleteModal } from "../delete-modal";
import { StickyInput } from "./inputs";
-import { useStickyOperations } from "./use-operations";
+import { getRandomStickyColor, useStickyOperations } from "./use-operations";
type TProps = {
onClose?: () => void;
@@ -33,7 +33,7 @@ export const StickyNote = observer((props: TProps) => {
// sticky operations
const { stickyOperations } = useStickyOperations({ workspaceSlug });
// derived values
- const stickyData = stickyId ? stickies[stickyId] : undefined;
+ const stickyData: Partial<TSticky> = stickyId ? stickies[stickyId] : { background_color: getRandomStickyColor() };
// const isStickiesPage = pathName?.includes("stickies");
const backgroundColor =
STICKY_COLORS_LIST.find((c) => c.key === stickyData?.background_color)?.backgroundColor ||
@@ -45,6 +45,7 @@ export const StickyNote = observer((props: TProps) => {
await stickyOperations.update(stickyId, payload);
} else {
await stickyOperations.create({
+ ...stickyData,
...payload,
});
}
@@ -73,7 +74,7 @@ export const StickyNote = observer((props: TProps) => {
handleClose={() => setIsDeleteModalOpen(false)}
/>
<div
- className={cn("w-full flex flex-col h-fit rounded p-4 group/sticky", className)}
+ className={cn("w-full flex flex-col h-fit rounded p-4 group/sticky max-h-[650px] overflow-y-scroll", className)}
style={{
backgroundColor,
}}
diff --git a/web/core/services/sticky.service.ts b/web/core/services/sticky.service.ts
index 5f51b9e7d0..7e31b311be 100644
--- a/web/core/services/sticky.service.ts
+++ b/web/core/services/sticky.service.ts
@@ -21,12 +21,13 @@ export class StickyService extends APIService {
async getStickies(
workspaceSlug: string,
cursor: string,
- query?: string
+ query?: string,
+ per_page?: number
): Promise<{ results: TSticky[]; total_pages: number }> {
return this.get(`/api/workspaces/${workspaceSlug}/stickies/`, {
params: {
cursor,
- per_page: STICKIES_PER_PAGE,
+ per_page: per_page || STICKIES_PER_PAGE,
query,
},
})
diff --git a/web/core/store/sticky/sticky.store.ts b/web/core/store/sticky/sticky.store.ts
index e3d292173e..0872551758 100644
--- a/web/core/store/sticky/sticky.store.ts
+++ b/web/core/store/sticky/sticky.store.ts
@@ -96,7 +96,7 @@ export class StickyStore implements IStickyStore {
};
fetchRecentSticky = async (workspaceSlug: string) => {
- const response = await this.stickyService.getStickies(workspaceSlug, "1:0:0");
+ const response = await this.stickyService.getStickies(workspaceSlug, "1:0:0", undefined, 1);
runInAction(() => {
this.recentStickyId = response.results[0]?.id;
this.stickies[response.results[0]?.id] = response.results[0];