Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 13 additions & 9 deletions apiserver/plane/app/views/workspace/recent_visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ..base import BaseViewSet
from plane.app.permissions import allow_permission, ROLE


class UserRecentVisitViewSet(BaseViewSet):
model = UserRecentVisit

Expand All @@ -17,15 +18,18 @@ def get_serializer_class(self):

@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST], level="WORKSPACE")
def list(self, request, slug):
user_recent_visits = UserRecentVisit.objects.filter(workspace__slug=slug)
user_recent_visits = UserRecentVisit.objects.filter(
workspace__slug=slug, user=request.user
)

entity_name = request.query_params.get("entity_name")

entity_name = request.query_params.get("entity_name")
if entity_name:
user_recent_visits = user_recent_visits.filter(entity_name=entity_name)

if entity_name:
user_recent_visits = user_recent_visits.filter(entity_name=entity_name)

user_recent_visits = user_recent_visits.filter(entity_name__in=["issue","page","project"])

serializer = WorkspaceRecentVisitSerializer(user_recent_visits[:20], many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
user_recent_visits = user_recent_visits.filter(
entity_name__in=["issue", "page", "project"]
)

serializer = WorkspaceRecentVisitSerializer(user_recent_visits[:20], many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
60 changes: 0 additions & 60 deletions web/app/[workspaceSlug]/(projects)/home/header.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions web/app/[workspaceSlug]/(projects)/home/page.tsx

This file was deleted.

55 changes: 46 additions & 9 deletions web/core/components/core/content-overflow-HOC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export const ContentOverflowWrapper = observer((props: IContentOverflowWrapper)
// states
const [containerHeight, setContainerHeight] = useState(0);
const [showAll, setShowAll] = useState(false);
const [isTransitioning, setIsTransitioning] = useState(false);

// refs
const contentRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement>(null);

useEffect(() => {
if (!contentRef?.current) return;
Expand Down Expand Up @@ -70,37 +72,72 @@ export const ContentOverflowWrapper = observer((props: IContentOverflowWrapper)
};
}, [contentRef?.current]);

useEffect(() => {
if (!containerRef.current) return;

const handleTransitionEnd = () => {
setIsTransitioning(false);
};

containerRef.current.addEventListener("transitionend", handleTransitionEnd);

return () => {
containerRef.current?.removeEventListener("transitionend", handleTransitionEnd);
};
}, []);

const handleToggle = () => {
setIsTransitioning(true);
setShowAll((prev) => !prev);
};

if (!children) return fallback;

return (
<div
ref={containerRef}
className={cn(
"relative",
{
[`overflow-hidden`]: !showAll,
"overflow-visible": showAll,
[`overflow-hidden transition-[height] duration-300 ease-in-out`]: containerHeight > maxHeight,
},
containerClassName
)}
style={{ maxHeight: showAll ? "100%" : `${maxHeight}px` }}
style={{
height: showAll ? `${containerHeight}px` : `${Math.min(maxHeight, containerHeight)}px`,
}}
>
<div ref={contentRef}>{children}</div>
<div
ref={contentRef}
className={cn("h-auto", {
"pb-6": showAll,
})}
>
{children}
</div>

{containerHeight > maxHeight && (
<div
className={cn(
"bottom-0 left-0 w-full",
"bottom-0 left-0 w-full transition-all duration-300 ease-in-out",
`bg-gradient-to-t from-custom-background-100 to-transparent flex flex-col items-center justify-end`,
"text-center",
{
"absolute h-[100px]": !showAll,
"h-[30px]": showAll,
"absolute h-[100px] opacity-100": !showAll,
"absolute h-[30px] opacity-70": showAll,
}
)}
style={{
pointerEvents: isTransitioning ? "none" : "auto",
}}
>
<button
className={cn("gap-1 w-full text-custom-primary-100 text-sm font-medium", buttonClassName)}
onClick={() => setShowAll((prev) => !prev)}
className={cn(
"gap-1 w-full text-custom-primary-100 text-sm font-medium transition-opacity duration-300",
buttonClassName
)}
onClick={handleToggle}
disabled={isTransitioning}
>
{showAll ? "Show less" : "Show all"}
</button>
Expand Down
21 changes: 11 additions & 10 deletions web/core/components/home/widgets/links/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@ export const ProjectLinkList: FC<TProjectLinkList> = observer((props) => {
if (links === undefined) return <WidgetLoader widgetKey={EWidgetKeys.QUICK_LINKS} />;

if (links.length === 0) return <LinksEmptyState handleCreate={() => toggleLinkModal(true)} />;

return (
<ContentOverflowWrapper
maxHeight={150}
containerClassName="pb-2 box-border"
fallback={<></>}
buttonClassName="bg-custom-background-90/20"
>
<div>
<div className="flex gap-2 mb-2 flex-wrap">
<div className="relative">
<ContentOverflowWrapper
maxHeight={150}
containerClassName="box-border min-h-[30px] flex flex-col"
fallback={<></>}
buttonClassName="bg-custom-background-90/20"
>
<div className="flex gap-2 mb-2 flex-wrap flex-1">
{links &&
links.length > 0 &&
links.map((linkId) => <ProjectLinkDetail key={linkId} linkId={linkId} linkOperations={linkOperations} />)}
</div>
</div>
</ContentOverflowWrapper>
</ContentOverflowWrapper>
</div>
);
});
14 changes: 11 additions & 3 deletions web/core/components/home/widgets/recents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { FiltersDropdown } from "./filters";
import { RecentIssue } from "./issue";
import { RecentPage } from "./page";
import { RecentProject } from "./project";
import { ContentOverflowWrapper } from "@/components/core/content-overflow-HOC";

const WIDGET_KEY = EWidgetKeys.RECENT_ACTIVITY;
const workspaceService = new WorkspaceService();
Expand Down Expand Up @@ -79,7 +80,12 @@ export const RecentActivityWidget: React.FC<THomeWidgetProps> = observer((props)
);

return (
<div ref={ref} className=" max-h-[500px] min-h-[250px] overflow-y-scroll">
<ContentOverflowWrapper
maxHeight={415}
containerClassName="box-border min-h-[250px]"
fallback={<></>}
buttonClassName="bg-custom-background-90/20"
>
<div className="flex items-center justify-between mb-2">
<div className="text-base font-semibold text-custom-text-350">Recents</div>

Expand All @@ -89,8 +95,10 @@ export const RecentActivityWidget: React.FC<THomeWidgetProps> = observer((props)
{isLoading && <WidgetLoader widgetKey={WIDGET_KEY} />}
{!isLoading &&
recents?.length > 0 &&
recents.map((activity: TActivityEntityData) => <div key={activity.id}>{resolveRecent(activity)}</div>)}
recents
.filter((recent: TActivityEntityData) => recent.entity_data)
.map((activity: TActivityEntityData) => <div key={activity.id}>{resolveRecent(activity)}</div>)}
</div>
</div>
</ContentOverflowWrapper>
);
});
Loading