unknown
1 month ago
4 changed files with 130 additions and 29 deletions
-
3public/assets/images/Icon ionic-md-musical-notes.svg
-
2src/components/layout/header.tsx
-
76src/components/sidebar/list.tsx
-
54src/pages/last-reads.tsx
@ -0,0 +1,3 @@ |
|||
<svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg"> |
|||
<path d="M2.68594 0V7.20712C2.45651 7.13158 2.20471 7.09241 1.94171 7.09241C0.870131 7.09241 0 7.85061 0 8.92217C0 9.99372 0.870131 10.7435 1.94171 10.7435C3.01329 10.7435 3.88901 9.95455 3.88901 8.81026V3.805H9.54067V7.20712C9.31125 7.13158 9.05944 7.09241 8.79644 7.09241C7.72487 7.09241 6.85474 7.85061 6.85474 8.92217C6.85474 9.99372 7.72487 10.7435 8.79644 10.7435C9.86802 10.7435 10.7437 9.95455 10.7437 8.81026V0H2.68594ZM9.54067 2.68588H3.88901V1.20305H9.54067V2.68588Z" fill="#8B8B8B"/> |
|||
</svg> |
@ -0,0 +1,54 @@ |
|||
import Image from "next/image"; |
|||
import { useEffect, useState } from "react"; |
|||
import Audio from "../../public/assets/images/Icon ionic-md-musical-notes.svg"; |
|||
import { useRouter } from "next/router"; |
|||
|
|||
const LastReads = () => { |
|||
const [lastDuas , setLastDuas] = useState([]) |
|||
const router = useRouter() |
|||
|
|||
const openDua = (dua: Dua) => { |
|||
setPath((prev) => [...prev, { name: dua.name, type: "dua" }]); |
|||
setLastReads((prev) => [...prev, dua]); |
|||
const slug = dua.title.toLowerCase().replaceAll(" ", "-"); |
|||
router.push(`?dua=${slug}-${dua.id}`); |
|||
}; |
|||
|
|||
|
|||
|
|||
useEffect(()=>{ |
|||
const local = JSON.parse(localStorage.getItem("last-read")) |
|||
setLastDuas(local) |
|||
} , []) |
|||
console.log(lastDuas); |
|||
|
|||
return ( |
|||
<aside |
|||
className={`w-full h-[calc(100vh-55px)] self-start overflow-auto rounded-3xl p-6 lg:max-w-[430px] lg:bg-[#F5F5F5]
|
|||
}`}
|
|||
> |
|||
{lastDuas?.map((dua : {id : string | number , title : string , not_synced : boolean})=>( |
|||
<div |
|||
className="flex justify-between p-3 bg-white my-4 rounded-2xl" |
|||
key={dua.id} |
|||
onClick={() => openDua(dua)} |
|||
> |
|||
<div className="flex items-center gap-2"> |
|||
<p>{dua.title}</p> |
|||
</div> |
|||
{dua.not_synced && ( |
|||
<div className="flex items-center p-3 bg-[#EBEBEB] rounded-lg"> |
|||
<Image src={Audio} alt="audio available" /> |
|||
</div> |
|||
)} |
|||
</div> |
|||
|
|||
))} |
|||
</aside> |
|||
); |
|||
}; |
|||
|
|||
export default LastReads; |
|||
|
|||
// ${
|
|||
// slug && "hidden lg:block"
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue