From d411cd7576f34333dd6133af718e4186beb09990 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Mon, 10 Apr 2023 22:46:09 +0530 Subject: [PATCH] style: redesign view (#770) * style: add new design to the view item * feat: add no of filters --- .../app/components/views/single-view-item.tsx | 146 +++++++++++------- .../projects/[projectId]/views/index.tsx | 4 +- 2 files changed, 91 insertions(+), 59 deletions(-) diff --git a/apps/app/components/views/single-view-item.tsx b/apps/app/components/views/single-view-item.tsx index 931435a79..b17ee29b4 100644 --- a/apps/app/components/views/single-view-item.tsx +++ b/apps/app/components/views/single-view-item.tsx @@ -1,23 +1,24 @@ import React, { useState } from "react"; - +import { mutate } from "swr"; import Link from "next/link"; import { useRouter } from "next/router"; -import { IView } from "types"; // icons -import { TrashIcon, StarIcon } from "@heroicons/react/24/outline"; +import { TrashIcon, StarIcon, PencilIcon } from "@heroicons/react/24/outline"; import { StackedLayersIcon } from "components/icons"; - //components -import { CustomMenu } from "components/ui"; - +import { CustomMenu, Tooltip } from "components/ui"; +// services import viewsService from "services/views.service"; - -import { mutate } from "swr"; - +// types +import { IView } from "types"; +// fetch keys import { VIEWS_LIST } from "constants/fetch-keys"; - +// hooks import useToast from "hooks/use-toast"; +// helpers +import { truncateText } from "helpers/string.helper"; +import { renderShortDate, renderShortTime } from "helpers/date-time.helper"; type Props = { view: IView; @@ -81,63 +82,94 @@ export const SingleViewItem: React.FC = ({ view, setSelectedView }) => { }; return ( - - -
-
-
+
  • + + +
    +
    - {view.name} +

    {truncateText(view.name, 75)}

    -
    - {view.is_favorite ? ( - - ) : ( - - )} - - { - e.preventDefault(); - e.stopPropagation(); - setSelectedView(view); - }} - > - - - Delete - - - +

    {renderShortTime(view.updated_at)}

    + + {view.is_favorite ? ( + + ) : ( + + )} + + {/* { + e.preventDefault(); + e.stopPropagation(); + // handleEditView(); + }} + > + + + Edit View + + */} + { + e.preventDefault(); + e.stopPropagation(); + setSelectedView(view); + }} + > + + + Delete View + + + +
    {view?.description && ( -

    +

    {view.description}

    )}
  • -
    - - + + + ); }; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx index af4d57ff3..b8f3a4344 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx @@ -86,11 +86,11 @@ const ProjectViews: NextPage = () => { views.length > 0 ? (

    Views

    -
    +
      {views.map((view) => ( ))} -
    +
    ) : (