mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-19 07:42:43 +00:00
Merge pull request #171 from JedPattersonn/jed/fix-breadcrumb
This commit is contained in:
commit
1707103fda
2 changed files with 31 additions and 11 deletions
|
|
@ -33,6 +33,7 @@ import { addUserToSpace, deleteItem, moveItem } from "@/app/actions/doers";
|
|||
import { toast } from "sonner";
|
||||
import { Input } from "@repo/ui/shadcn/input";
|
||||
import { motion } from "framer-motion";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
export function MemoriesPage({
|
||||
memoriesAndSpaces,
|
||||
|
|
@ -45,7 +46,19 @@ export function MemoriesPage({
|
|||
currentSpace?: StoredSpace;
|
||||
usersWithAccess?: string[];
|
||||
}) {
|
||||
const [filter, setFilter] = useState("All");
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const tab = searchParams.get("tab");
|
||||
|
||||
const initialFilter = useMemo(() => {
|
||||
if (tab === "spaces") return "Spaces";
|
||||
if (tab === "pages") return "Pages";
|
||||
if (tab === "notes") return "Notes";
|
||||
if (tab === "tweet") return "Tweet";
|
||||
return "All";
|
||||
}, [tab]);
|
||||
|
||||
const [filter, setFilter] = useState(initialFilter);
|
||||
|
||||
// Sort Both memories and spaces by their savedAt and createdAt dates respectfully.
|
||||
// The output should be just one single list of items
|
||||
|
|
|
|||
|
|
@ -27,16 +27,23 @@ function AutoBreadCrumbs() {
|
|||
{pathname
|
||||
.split("/")
|
||||
.filter(Boolean)
|
||||
.map((path, idx, paths) => (
|
||||
<>
|
||||
<BreadcrumbItem key={path + idx}>
|
||||
<BreadcrumbLink href={`/${paths.slice(0, idx + 1).join("/")}`}>
|
||||
{path.charAt(0).toUpperCase() + path.slice(1)}
|
||||
</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator hidden={idx === paths.length - 1} />
|
||||
</>
|
||||
))}
|
||||
.map((path, idx, paths) => {
|
||||
const isSpacePath = path === "space";
|
||||
const href = isSpacePath
|
||||
? `/memories?tab=spaces`
|
||||
: `/${paths.slice(0, idx + 1).join("/")}`;
|
||||
|
||||
return (
|
||||
<React.Fragment key={path + idx}>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink href={href}>
|
||||
{path.charAt(0).toUpperCase() + path.slice(1)}
|
||||
</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator hidden={idx === paths.length - 1} />
|
||||
</React.Fragment>
|
||||
);
|
||||
})}
|
||||
</BreadcrumbList>
|
||||
</Breadcrumb>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue