small fix

This commit is contained in:
Daniel 2023-06-05 13:46:04 +03:30
parent a9d7303359
commit 2b82d2aa8a
3 changed files with 34 additions and 8 deletions

View File

@ -1,4 +1,7 @@
import { LinkIncludingCollectionAndTags } from "@/types/global"; import {
CollectionIncludingMembers,
LinkIncludingCollectionAndTags,
} from "@/types/global";
import { import {
faFolder, faFolder,
faArrowUpRightFromSquare, faArrowUpRightFromSquare,
@ -6,13 +9,14 @@ import {
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons"; import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useState } from "react"; import { useEffect, useState } from "react";
import Image from "next/image"; import Image from "next/image";
import Dropdown from "./Dropdown"; import Dropdown from "./Dropdown";
import useLinkStore from "@/store/links"; import useLinkStore from "@/store/links";
import Modal from "./Modal"; import Modal from "./Modal";
import LinkModal from "./Modal/LinkModal"; import LinkModal from "./Modal/LinkModal";
import Link from "next/link"; import Link from "next/link";
import useCollectionStore from "@/store/collections";
type Props = { type Props = {
link: LinkIncludingCollectionAndTags; link: LinkIncludingCollectionAndTags;
@ -23,6 +27,22 @@ export default function ({ link, count }: Props) {
const [expandDropdown, setExpandDropdown] = useState(false); const [expandDropdown, setExpandDropdown] = useState(false);
const [editModal, setEditModal] = useState(false); const [editModal, setEditModal] = useState(false);
const { collections } = useCollectionStore();
const [collection, setCollection] = useState<CollectionIncludingMembers>(
collections.find(
(e) => e.id === link.collection.id
) as CollectionIncludingMembers
);
useEffect(() => {
setCollection(
collections.find(
(e) => e.id === link.collection.id
) as CollectionIncludingMembers
);
}, [collections]);
const { removeLink } = useLinkStore(); const { removeLink } = useLinkStore();
const url = new URL(link.url); const url = new URL(link.url);
@ -88,9 +108,9 @@ export default function ({ link, count }: Props) {
<FontAwesomeIcon <FontAwesomeIcon
icon={faFolder} icon={faFolder}
className="w-4 h-4 mt-1" className="w-4 h-4 mt-1"
style={{ color: link.collection.color }} style={{ color: collection.color }}
/> />
<p className="text-sky-900">{link.collection.name}</p> <p className="text-sky-900">{collection.name}</p>
</div> </div>
</Link> </Link>

View File

@ -77,7 +77,6 @@ export default function () {
}, [collections, sortBy]); }, [collections, sortBy]);
return ( return (
// ml-80
<MainLayout> <MainLayout>
<div className="p-5"> <div className="p-5">
<div className="flex gap-3 items-center justify-between mb-5"> <div className="flex gap-3 items-center justify-between mb-5">

View File

@ -70,9 +70,16 @@ export default function Links() {
<MainLayout> <MainLayout>
<div className="p-5 flex flex-col gap-5 w-full"> <div className="p-5 flex flex-col gap-5 w-full">
<div className="flex gap-3 items-center justify-between"> <div className="flex gap-3 items-center justify-between">
<div className="flex gap-2 items-center"> <div className="flex gap-3 items-center mb-5">
<FontAwesomeIcon icon={faSearch} className="w-5 h-5 text-sky-300" /> <div className="flex gap-2">
<p className="text-lg text-sky-900">Search Results</p> <FontAwesomeIcon
icon={faSearch}
className="sm:w-8 sm:h-8 w-6 h-6 mt-2 text-sky-500"
/>
<p className="sm:text-4xl text-3xl capitalize bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent font-bold">
Search Results
</p>
</div>
</div> </div>
<div className="flex gap-3 items-center"> <div className="flex gap-3 items-center">