Browse Source
feat: implement RTL support, adjust layout for RTL languages, and remove unused Last Reads page
master
feat: implement RTL support, adjust layout for RTL languages, and remove unused Last Reads page
master
sina_sajjadi
2 weeks ago
7 changed files with 204 additions and 128 deletions
-
111src/components/modals/languages-modal.tsx
-
65src/components/sidebar/list.tsx
-
11src/components/sticky-components/audio-controls.tsx
-
39src/components/ui/range-input.tsx
-
35src/pages/_app.tsx
-
2src/pages/duas/[slug].tsx
-
69src/pages/last-reads.tsx
@ -1,69 +0,0 @@ |
|||
import Image from "next/image"; |
|||
import { useEffect, useState } from "react"; |
|||
import Audio from "../../public/assets/images/Icon ionic-md-musical-notes.svg"; |
|||
import NoData from "../../public/assets/images/Untitled-1-02.svg"; |
|||
|
|||
import DuaComponent from "./duas/[slug]"; |
|||
import { Dua } from "@/components/utils/types"; |
|||
|
|||
const LastReads = () => { |
|||
const [lastDuas, setLastDuas] = useState([]); |
|||
const [SelectedDua, setSelectedDua] = useState(""); |
|||
|
|||
const openDua = (dua: Dua) => { |
|||
const slug = dua.title.toLowerCase().replaceAll(" ", "-"); |
|||
setSelectedDua(`${slug}-${dua.id}`); |
|||
}; |
|||
|
|||
useEffect(() => { |
|||
const local = localStorage.getItem("last-read"); |
|||
if (local) { |
|||
setLastDuas(JSON.parse(local)); |
|||
} else { |
|||
setLastDuas([]); // Set default value if the item does not exist
|
|||
} |
|||
}, []); |
|||
|
|||
return ( |
|||
<div className="flex flex-col lg:flex-row gap-6 "> |
|||
<aside |
|||
className={`w-full h-[calc(100vh-130px)] self-start overflow-auto rounded-3xl p-6 lg:max-w-[430px] lg:bg-[#F5F5F5]
|
|||
${SelectedDua && "hidden lg:block"}`}
|
|||
> |
|||
{lastDuas?.map((dua: Dua) => ( |
|||
<div |
|||
className="flex justify-between p-3 bg-white my-4 rounded-2xl cursor-pointer" |
|||
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> |
|||
{SelectedDua ? ( |
|||
<DuaComponent |
|||
setSelectedDua={setSelectedDua} |
|||
SelectedDua={SelectedDua} |
|||
/> |
|||
) : ( |
|||
<div |
|||
className={`flex-grow w-full items-center justify-center h-[calc(100vh-130px)] bg-[#F5F5F5] lg:p-6 lg:rounded-3xl hidden lg:flex`} |
|||
> |
|||
<Image src={NoData} alt="no data" /> |
|||
</div> |
|||
)} |
|||
</div> |
|||
); |
|||
}; |
|||
|
|||
export default LastReads; |
|||
|
|||
// ${
|
|||
// slug && "hidden lg:block"
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue