diff --git a/components/AgentsTableRow.tsx b/components/AgentsTableRow.tsx index 5f718886..1d9783ed 100644 --- a/components/AgentsTableRow.tsx +++ b/components/AgentsTableRow.tsx @@ -17,7 +17,7 @@ import { PersonWithFileEssential } from "lib/types/extensions"; import { useTranslation } from "next-i18next"; import Link from "next/link"; -import BrDisplayUser from "./brickroom/BrDisplayUser"; +import BrUserDisplay from "./brickroom/BrUserDisplay"; const AgentsTableRow = (props: { agent: Partial }) => { const { agent: e } = props; @@ -28,7 +28,7 @@ const AgentsTableRow = (props: { agent: Partial }) => { return ( - + diff --git a/components/ContributionsTable.tsx b/components/ContributionsTable.tsx index 58599586..222cc755 100644 --- a/components/ContributionsTable.tsx +++ b/components/ContributionsTable.tsx @@ -20,9 +20,9 @@ import { QUERY_RESOURCE_PROPOSAlS } from "lib/QueryAndMutation"; import { ResourceProposalsQuery, ResourceProposalsQueryVariables } from "lib/types"; import { useTranslation } from "next-i18next"; import Link from "next/link"; -import BrDisplayUser from "./brickroom/BrDisplayUser"; import BrTable from "./brickroom/BrTable"; import PTitleCounter from "./polaris/PTitleCounter"; +import BrUserDisplay from "./brickroom/BrUserDisplay"; const ContributionsTable = ({ id, title }: { id: string; title?: string }) => { const { t } = useTranslation("common"); @@ -41,7 +41,7 @@ const ContributionsTable = ({ id, title }: { id: string; title?: string }) => { {/* @ts-ignore */} - + {proposal.node.note} diff --git a/components/ProjectsTable.tsx b/components/ProjectsTable.tsx deleted file mode 100644 index c516a2b3..00000000 --- a/components/ProjectsTable.tsx +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-or-later -// Copyright (C) 2022-2023 Dyne.org foundation . -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import cn from "classnames"; -import { useTranslation } from "next-i18next"; -import { useEffect, useState } from "react"; - -// Request -import { useQuery } from "@apollo/client"; -import { FETCH_RESOURCES } from "lib/QueryAndMutation"; -import { EconomicResourceFilterParams, FetchInventoryQuery, FetchInventoryQueryVariables } from "lib/types"; - -// Components -import { AdjustmentsIcon } from "@heroicons/react/outline"; -import useLoadMore from "../hooks/useLoadMore"; -import Spinner from "./brickroom/Spinner"; -import PTitleCounter from "./polaris/PTitleCounter"; -import ProjectsFilters from "./ProjectsFilters"; -import ProjectsTableBase from "./ProjectsTableBase"; - -// - -export interface ProjectsTableProps { - filter?: EconomicResourceFilterParams; - hideHeader?: boolean; - hidePagination?: boolean; - hidePrimaryAccountable?: boolean; - id?: string[]; - searchFilter?: React.ReactNode; - hideFilters?: boolean; -} - -// - -export default function ProjectsTable(props: ProjectsTableProps) { - const { t } = useTranslation("lastUpdatedProps"); - const { - filter = {}, - hideHeader = false, - hidePagination = false, - hidePrimaryAccountable = false, - searchFilter, - hideFilters = false, - } = props; - - const { loading, data, fetchMore, refetch, variables } = useQuery( - FETCH_RESOURCES, - { - variables: { last: 10, filter: filter }, - } - ); - - const dataQueryIdentifier = "economicResources"; - - const { loadMore, items, showEmptyState, getHasNextPage } = useLoadMore({ - fetchMore, - refetch, - variables, - data, - dataQueryIdentifier, - }); - - const [showFilter, setShowFilter] = useState(false); - - useEffect(() => { - const showFiltersAtRender = !!filter.conformsTo || !!filter.primaryAccountable || !!filter.classifiedAs; - setShowFilter(showFiltersAtRender); - }, [filter]); - - const toggleFilter = () => setShowFilter(!showFilter); - - return ( - <> - {loading && ( -
- -
- )} - {!loading && ( -
- {/* Header */} -
- {/* Left side */} - {!hideHeader &&

{t("Projects")}

} - - {/* Right side */} - {!hideFilters && ( - - )} -
- {/* Table and filters */} -
- {data && ( -
- - -
- )} - {showFilter && !hideFilters && ( -
- {searchFilter} -
- )} -
-
- )} - - ); -} diff --git a/components/ProjectsTableBase.tsx b/components/ProjectsTableBase.tsx deleted file mode 100644 index 2e17b215..00000000 --- a/components/ProjectsTableBase.tsx +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-or-later -// Copyright (C) 2022-2023 Dyne.org foundation . -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import { EconomicResource } from "lib/types"; -import { useTranslation } from "next-i18next"; - -// Components -import Link from "next/link"; -import BrTable from "./brickroom/BrTable"; -import ProjectsTableRow from "./ProjectsTableRow"; - -// - -export interface ProjectsTableBaseProps { - projects: EconomicResource[]; - hidePagination?: boolean; - onLoadMore?: () => void; - showEmptyState?: boolean; - hasNextPage?: boolean; -} - -// - -export default function ProjectsTableBase(props: ProjectsTableBaseProps) { - const { projects, hidePagination = false, onLoadMore = () => {}, showEmptyState = !projects, hasNextPage } = props; - const { t } = useTranslation("lastUpdatedProps"); - - return ( -
- - {projects?.map((e: any) => ( - - ))} - - - {/* Empty state */} - {showEmptyState && ( -
-

{t("Create a new project")}

-

{t("empty_state_projects")}

- - {t("Create project")} - -
- )} - - {/* Pagination */} - {!hidePagination && ( -
- {hasNextPage && ( - - )} -
- )} -
- ); -} diff --git a/components/ProjectsTableRow.tsx b/components/ProjectsTableRow.tsx deleted file mode 100644 index 665162df..00000000 --- a/components/ProjectsTableRow.tsx +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-or-later -// Copyright (C) 2022-2023 Dyne.org foundation . -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import { EconomicResource } from "lib/types"; -import Link from "next/link"; -import { useRouter } from "next/router"; -import dayjs from "../lib/dayjs"; -import AvatarUsers from "./AvatarUsers"; -import ProjectThumb from "./ProjectThumb"; -import BrDisplayUser from "./brickroom/BrDisplayUser"; -import BrTags from "./brickroom/BrTags"; - -const ProjectsTableRow = (props: { project: { node: EconomicResource } }) => { - const e = props.project.node; - const router = useRouter(); - - // @ts-ignore - const data = e.trace?.filter((t: any) => !!t.hasPointInTime)[0].hasPointInTime; - - const conformsToColors: { [key: string]: string } = { - Design: "bg-[#E4CCE3] text-[#C18ABF] border-[#C18ABF]", - Product: "bg-[#CDE4DF] text-[#614C1F] border-[#614C1F]", - Service: "bg-[#FAE5B7] text-[#A05D5D] border-[#A05D5D]", - }; - - const handleCoformstoClick = (conformsTo: string) => { - router.query.conformsTo = conformsTo; - router.push({ pathname: router.pathname, query: router.query }); - }; - - if (!e) return ; - - return ( - - - -
-
- -
-

{e.name}

- {/*

{e.note}

*/} -
- - - - - - - - -

{dayjs(data).fromNow()}

-

{dayjs(data).format("HH:mm DD/MM/YYYY")}

- - - - - - - - - - - - ); -}; - -export default ProjectsTableRow; diff --git a/components/brickroom/BrDisplayUser.tsx b/components/brickroom/BrDisplayUser.tsx deleted file mode 100644 index bbb49fe0..00000000 --- a/components/brickroom/BrDisplayUser.tsx +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-or-later -// Copyright (C) 2022-2023 Dyne.org foundation . -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import { LocationMarkerIcon } from "@heroicons/react/solid"; -import { PersonWithFileEssential } from "lib/types/extensions"; -import Link from "next/link"; -import BrUserAvatar from "./BrUserAvatar"; - -type BrDisplayUserProps = { - user: Partial; -}; - -const BrDisplayUser = (props: BrDisplayUserProps) => { - const { user } = props; - const location = user.primaryLocation; - - return ( - - - -
-

{user.name}

- {location && ( - - - {location.mappableAddress} - - )} -
-
- - ); -}; -export default BrDisplayUser; diff --git a/components/partials/project/[id]/sidebar/SocialCard.tsx b/components/partials/project/[id]/sidebar/SocialCard.tsx index dd2d2ade..4e6401db 100644 --- a/components/partials/project/[id]/sidebar/SocialCard.tsx +++ b/components/partials/project/[id]/sidebar/SocialCard.tsx @@ -2,7 +2,7 @@ import { Button, Card, Icon, Stack, Text } from "@bbtgnn/polaris-interfacer"; import { LinkMinor, PlusMinor } from "@shopify/polaris-icons"; import DetailMap from "components/DetailMap"; import WatchButton from "components/WatchButton"; -import BrDisplayUser from "components/brickroom/BrDisplayUser"; +import BrUserDisplay from "components/brickroom/BrUserDisplay"; import { useProject } from "components/layout/FetchProjectLayout"; import { useAuth } from "hooks/useAuth"; import useStorage from "hooks/useStorage"; @@ -44,7 +44,7 @@ const SocialCard = () => { {t("By:")} - + {project.currentLocation && }