File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { createOpenAlexTree } from "./createTree";
77import { useMutation } from "@tanstack/react-query" ;
88import { logEvent } from "firebase/analytics" ;
99import { useState } from "react" ;
10- import { useNavigate } from "react-router-dom" ;
10+ import { Link , useNavigate } from "react-router-dom" ;
1111
1212const New = ( ) => {
1313 const navigate = useNavigate ( ) ;
@@ -22,7 +22,7 @@ const New = () => {
2222 } ) ;
2323
2424 return (
25- < div >
25+ < div className = "flex flex-col gap-8" >
2626 < form
2727 className = "flex flex-col gap-8"
2828 onSubmit = { ( e ) => {
@@ -50,6 +50,14 @@ const New = () => {
5050 </ button >
5151 </ div >
5252 </ form >
53+ < div className = "flex flex-row items-center justify-center" >
54+ < Link
55+ className = "text-sky-600 hover:text-sky-800 active:text-sky-800"
56+ to = "/history"
57+ >
58+ Tree History
59+ </ Link >
60+ </ div >
5361 </ div >
5462 ) ;
5563} ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export const useTrees = (userId: string, max: number) => {
2525 const firebase = useFirebase ( ) ;
2626 const [ limit , setLimit ] = useState ( 25 ) ;
2727 const query = useQuery ( {
28- queryKey : [ "trees" , limit ] ,
28+ queryKey : [ "trees" , userId , limit ] ,
2929 queryFn : async ( ) => {
3030 const query = getQuery ( firebase . firestore , userId , limit ) ;
3131 return ( await getDocs ( query ) ) . docs ;
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ const TreeHistory = ({ userId }: Props) => {
3939
4040 if ( ! user ) return "You must log in to see your history" ;
4141 if ( ! trees . query . data ?. length ) return "No trees found" ;
42+ if ( trees . query . isError ) return "There was an error loading your trees" ;
4243
4344 const data = sortBy (
4445 trees . query . data . map ( ( doc ) => {
@@ -57,7 +58,7 @@ const TreeHistory = ({ userId }: Props) => {
5758 < div className = "flex flex-col gap-3" >
5859 { user . plan === "basic" ? (
5960 < ul className = "flex flex-col gap-2" >
60- < Items trees = { data . slice ( 3 ) } />
61+ < Items trees = { data . slice ( 0 , 3 ) } />
6162 </ ul >
6263 ) : (
6364 < div className = "flex flex-col gap-8" >
You can’t perform that action at this time.
0 commit comments