diff --git a/.env.example b/.env.example index dcb7db53df..c6a0ff437a 100644 --- a/.env.example +++ b/.env.example @@ -5,3 +5,5 @@ PUBLIC_FIREBASE_STORAGE_BUCKET= PUBLIC_FIREBASE_MESSAGING_SENDER_ID= PUBLIC_FIREBASE_APP_ID= PUBLIC_FIREBASE_MEASUREMENT_ID= + +PUBLIC_FEEDBACK_FISH_PROJECT_ID= diff --git a/.env.production b/.env.production deleted file mode 100644 index dcb7db53df..0000000000 --- a/.env.production +++ /dev/null @@ -1,7 +0,0 @@ -PUBLIC_FIREBASE_API_KEY= -PUBLIC_FIREBASE_AUTH_DOMAIN= -PUBLIC_FIREBASE_PROJECT_ID= -PUBLIC_FIREBASE_STORAGE_BUCKET= -PUBLIC_FIREBASE_MESSAGING_SENDER_ID= -PUBLIC_FIREBASE_APP_ID= -PUBLIC_FIREBASE_MEASUREMENT_ID= diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9ff6303b0e..6e63cf727d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -92,7 +92,7 @@ jobs: run: | echo "> Start remove unused files..." rm -rf .github/workflows .svelte-kit markdowns screenshoot scripts static src node_modules - rm -rf .all-contributorsrc .editorconfig .eslintignore .eslintrc.cjs .gitignore .kodiak.toml .npmrc .prettierignore .prettierrc package.json pnpm-lock.yaml postcss.config.js svelte.config.js tailwind.config.js tsconfig.json vite.config.ts .env.example .env.production .nvmrc + rm -rf .all-contributorsrc .editorconfig .eslintignore .eslintrc.cjs .gitignore .kodiak.toml .npmrc .prettierignore .prettierrc package.json pnpm-lock.yaml postcss.config.js svelte.config.js tailwind.config.js tsconfig.json vite.config.ts .env.example .nvmrc echo "> Copy build directory..." cp -r build/. ./ diff --git a/README.md b/README.md index a65325188b..b9978c4762 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # πŸ“– Baca-Quran.id ![Svelte Kit](https://img.shields.io/badge/SvelteKit-TypeScript-blue.svg) -[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg)](#contributors) [![Codecov](https://codecov.io/gh/mazipan/baca-quran.id/branch/master/graph/badge.svg)](https://codecov.io/gh/mazipan/baca-quran.id) ![Last Deployed](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.baca-quran.id%2Ftimestamp.json) @@ -29,8 +28,20 @@ Read Qur'an from Your Web Browser. No Ads, No Analytics, It's Totally Free. ## Local Setup +### Requirement + +- Node v20 (use [nvm](https://github.com/nvm-sh/nvm) or other version manager) +- pnpm v9: https://pnpm.io/installation + +### Install Dependencies + ```bash pnpm i +``` + +### Run in your local + +```bash pnpm run dev ``` @@ -42,27 +53,15 @@ pnpm run build Copy `build` folder to your hosting. -## Baca-Quran V1 - -V1 can be viewed in [`v1`](https://github.com/mazipan/baca-quran.id/tree/v1) branch. - -### Screenshots V1 +## Credits -| Light | Blueish | Nature | -| :------------------------------: | :----------------------------: | :--------------------------------: | -| ![light](screenshoot/tlight.png) | ![dark](screenshoot/tblue.png) | ![nature](screenshoot/tnature.png) | - -| Asmaul Husna | Al-Fatihah | Do'a Harian | -| :-------------------------------------------: | :---------------------------------------: | :---------------------------------------: | -| ![asmaul husna](screenshoot/asmaul-husna.png) | ![al-fatihah](screenshoot/al-fatihah.png) | ![doa harian](screenshoot/doa-harian.png) | - -## Credit - -- Thanks for awesome repo [quran-json](https://github.com/rioastamal/quran-json) by [@rioastamal](https://github.com/rioastamal) -- Asmaul Husna source from [islam.nu.or.id](https://islam.nu.or.id/ubudiyah/99-asmaul-husna-dan-artinya-1T8jl) -- Daily Do'a from [doaharianislami.com](http://www.doaharianislami.com/2017/06/kumpulan-doa-sehari-hari-lengkap-dalam-bahasa-arab-latin-dan-artinya.html) -- MP3 Audio from [kemenag.go.id](https://quran.kemenag.go.id/) -- Tahlil from [islam.nu.or.id](https://islam.nu.or.id/post/read/107344/susunan-bacaan-tahlil-doa-arwah-lengkap-dan-terjemahannya) +- [quran-json](https://github.com/rioastamal/quran-json) by [@rioastamal](https://github.com/rioastamal) +- Asmaul Husna: from [islam.nu.or.id](https://islam.nu.or.id/ubudiyah/99-asmaul-husna-dan-artinya-1T8jl) +- Daily Do'a: from [doaharianislami.com](http://www.doaharianislami.com/2017/06/kumpulan-doa-sehari-hari-lengkap-dalam-bahasa-arab-latin-dan-artinya.html) +- MP3 Audio: from [kemenag.go.id](https://quran.kemenag.go.id/) +- Tahlil: from [islam.nu.or.id](https://islam.nu.or.id/post/read/107344/susunan-bacaan-tahlil-doa-arwah-lengkap-dan-terjemahannya) +- Reverse Geolocation: [nominatim](https://nominatim.openstreetmap.org) +- Prayer Schedule: from [api.aladhan.com](https://api.aladhan.com) ## Icons & Backgrounds @@ -79,16 +78,12 @@ V1 can be viewed in [`v1`](https://github.com/mazipan/baca-quran.id/tree/v1) bra - πŸ‘‰ 🌍 [Paypal](https://www.paypal.me/mazipan?utm_source=github-mazipan) - πŸ‘‰ 🌍 [Ko-Fi](https://ko-fi.com/mazipan?utm_source=github-mazipan) ---- - -Copyright Β© 2018 by Irfan Maulana - ## Contributors Thanks goes to these wonderful people - - [![Contributors](https://contrib.rocks/image?repo=mazipan/baca-quran.id)](https://github.com/mazipan/baca-quran.id/graphs/contributors) - +--- + +Copyright Β© 2018-present by Irfan Maulana diff --git a/scripts/routes.js b/scripts/routes.js index 7f2374443c..64e6555e72 100644 --- a/scripts/routes.js +++ b/scripts/routes.js @@ -15,5 +15,6 @@ export const staticUrls = [ '/sync/', '/tahlil/', '/tasbih/', - '/wirid/' + '/wirid/', + '/pencatat-ibadah/' ]; diff --git a/src/lib/PrayerTimeCard.svelte b/src/lib/PrayerTimeCard.svelte index d0cad6e332..2f84e494ce 100644 --- a/src/lib/PrayerTimeCard.svelte +++ b/src/lib/PrayerTimeCard.svelte @@ -1,17 +1,12 @@ diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 564a033350..6fc137156c 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -29,7 +29,8 @@ export const CONSTANTS = { LAST_VERSES: 'vres', LOCATION: 'loc', PRAYER: 'pryr', - THEME: 'theme' + THEME: 'theme', + LOG_PRAYER: 'log' }, BISMILLAH: 'ο·½' }; @@ -80,6 +81,9 @@ export const META_DESC_TASBIH = `Tasbih online, mempermudah menghitung Dzikirmu export const META_TITLE_JADWAL_SHOLAT = `Jadwal sholat | ${TITLE_CONSTANTS.TITLE_META}`; export const META_DESC_JADWAL_SHOLAT = `Jadwal sholat sesuai lokasi πŸ’― gratis, ❌ tanpa iklan, ❌ tanpa analitik`; +export const META_TITLE_PENCATAT_IBADAH = `Pencatat Ibadah | ${TITLE_CONSTANTS.TITLE_META}`; +export const META_DESC_PENCATAT_IBADAH = `Pencatat Ibadah ${postfix(false)}`; + export const META_TITLE_SURAH = (name: string) => `Qur'an Surat ${name} | ${TITLE_CONSTANTS.TITLE_META}`; export const META_DESC_SURAH = (name: string) => `Qur'an Surat ${name} ${postfix(true)}`; @@ -91,6 +95,7 @@ export const META_TITLE_AYAH = ( translation?: string ) => `QS ${surahid}:${verseid}, Surat ${name} - ${translation}, Ayat ${verseid || 1} | ${TITLE_CONSTANTS.TITLE_META}`; + export const META_DESC_AYAH = ( verseid: string, surahid?: string, @@ -117,7 +122,8 @@ export type PageVariant = | 'TASBIH' | 'MAKKIYAH' | 'MADANIYAH' - | 'JADWAL_SHOLAT'; + | 'JADWAL_SHOLAT' + | 'CATAT_IBADAH'; export const SEO_TEXT = { ALL_SURAH: @@ -142,6 +148,8 @@ export const SEO_TEXT = { 'Tasbih online, mempermudah menghitung Dzikirmu. Langsung dari peramban, tanpa iklan, tanpa analitik, privasi aman dan gratis sepenuhnya.', JADWAL_SHOLAT: 'Jadwal sholat terlengkap. Langsung dari peramban, tanpa iklan, tanpa analitik, privasi aman dan gratis sepenuhnya.', + CATAT_SHOLAT: + 'Jadwal sholat terlengkap. Langsung dari peramban, tanpa iklan, tanpa analitik, privasi aman dan gratis sepenuhnya.', SURAH_DETAIL: '', AYAT_DETAIL: '' }; diff --git a/src/lib/utils/array.ts b/src/lib/utils/array.ts new file mode 100644 index 0000000000..57a494b138 --- /dev/null +++ b/src/lib/utils/array.ts @@ -0,0 +1,2 @@ +export const range = (start: number, stop: number, step = 1) => + Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step) diff --git a/src/lib/utils/date.ts b/src/lib/utils/date.ts new file mode 100644 index 0000000000..3564f28e44 --- /dev/null +++ b/src/lib/utils/date.ts @@ -0,0 +1,40 @@ +import dayjs from 'dayjs'; +import relativeTime from "dayjs/plugin/relativeTime"; +import duration from "dayjs/plugin/duration"; +import 'dayjs/locale/id' + +dayjs.locale('id') +dayjs.extend(relativeTime); +dayjs.extend(duration); + +export const getDayjs = () => { + return dayjs(); +}; + +export const getDayjsFormatted = (dateString: string, format: string) => { + return dayjs(dateString, format) +}; + +export const getDayInMonth = (dateString: string) => { + return dayjs(dateString).daysInMonth() +}; + +export const getMonthName = () => { + return dayjs().format('MMMM') +}; + +export const getCurrentDate = () => { + return dayjs().toDate().getDate(); +}; + +export const formatDate = (date: string, format: string) => { + return dayjs(date).format(format); +}; + +export const formatYYYYMMDD = (date: string) => { + return dayjs(date).format('YYYY-MM-DD'); +}; + +export const getMinuteDuration = (diffTime: number) => { + return dayjs.duration(diffTime, "minutes").humanize(true); +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9f416953db..1b5eefadb0 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -12,7 +12,8 @@ settingAutoNext, pinnedSurah, lastReadVerses, - settingLocation + settingLocation, + logPrayer, } from '../store'; import '../app.css'; @@ -85,6 +86,14 @@ } else { settingLocation.set(null); } + + const storageLogPrayer = localStorage.getItem(CONSTANTS.STORAGE_KEY.LOG_PRAYER); + if (storageLogPrayer) { + const parsedValue = JSON.parse(storageLogPrayer); + logPrayer.set(parsedValue); + } else { + settingLocation.set(null); + } } } }); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index f3d1d604fb..2c754bb988 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -45,6 +45,10 @@ { href: '/jadwal-sholat/', title: '⏰ Jadwal Sholat' + }, + { + href: '/pencatat-ibadah/', + title: '⏺️ Pencatat Ibadah' } ]; diff --git a/src/routes/pencatat-ibadah/+page.svelte b/src/routes/pencatat-ibadah/+page.svelte new file mode 100644 index 0000000000..b00c3bfc29 --- /dev/null +++ b/src/routes/pencatat-ibadah/+page.svelte @@ -0,0 +1,149 @@ + + + + + + +
+

⏺️ Pencatat Ibadah

+
+ +
+ +
+ +
+

Catatan ibadah pada {selectedDateFormatted}

+
+ {#each dayRanges as day (day)} + + {/each} +
+
+ {#each PRAYER_LIST as prayer (prayer.key)} + + + + + {/each} +
+
+ + diff --git a/src/routes/sync/+page.svelte b/src/routes/sync/+page.svelte index f25f392515..e446e3de1b 100644 --- a/src/routes/sync/+page.svelte +++ b/src/routes/sync/+page.svelte @@ -38,7 +38,8 @@ activeTheme, settingLocation, lastReadVerses, - pinnedSurah + pinnedSurah, + logPrayer, } from '../../store'; import { toast } from '../../store/toast'; import { CONSTANTS, TITLE_CONSTANTS } from '$lib/constants'; @@ -140,7 +141,8 @@ district: 'N/A' }, [CONSTANTS.STORAGE_KEY.LAST_VERSES]: [], - [CONSTANTS.STORAGE_KEY.PINNED_SURAH]: [] + [CONSTANTS.STORAGE_KEY.PINNED_SURAH]: [], + [CONSTANTS.STORAGE_KEY.LOG_PRAYER]: {} }; } }; @@ -155,7 +157,8 @@ [CONSTANTS.STORAGE_KEY.THEME]: $activeTheme || '', [CONSTANTS.STORAGE_KEY.LOCATION]: $settingLocation || null, [CONSTANTS.STORAGE_KEY.LAST_VERSES]: $lastReadVerses || null, - [CONSTANTS.STORAGE_KEY.PINNED_SURAH]: $pinnedSurah || null + [CONSTANTS.STORAGE_KEY.PINNED_SURAH]: $pinnedSurah || null, + [CONSTANTS.STORAGE_KEY.LOG_PRAYER]: $logPrayer || null }; const dbRef = collection(db, 'progress'); const q = query(dbRef, where('uid', '==', currentUser?.uid)); @@ -273,6 +276,15 @@ ); } + // log prayer + if (data?.[CONSTANTS.STORAGE_KEY.LOG_PRAYER]) { + logPrayer.set(data?.[CONSTANTS.STORAGE_KEY.LOG_PRAYER]); + localStorage.setItem( + CONSTANTS.STORAGE_KEY.LOG_PRAYER, + JSON.stringify(data?.[CONSTANTS.STORAGE_KEY.LOG_PRAYER] || []) + ); + } + currentRemoteProgress = doc.data(); } }); diff --git a/src/store/index.ts b/src/store/index.ts index 31c2aab771..ec2ee79e41 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -53,3 +53,18 @@ export type BookmarkVerseItem = { }; export const lastReadVerses = writable([]); + +export type LogPrayerItemKey = '1' | '2' | '3' | '4' | '5'; +export type LogPrayerItemValue = 1 | 0; +export type LogPrayerValue = Record; +/** + * Key is date in YYYYMMDD format + * Value is record { id: 1 | 0 } + * ID is ==> 1: Fajr, 2: Dhuhr, 3: Asr, 4: Maghrib, 5: Isha + */ +export type LogPrayer = Record; + +export const logPrayer = writable({}); +export const getLogPrayer = () => { + return get(logPrayer); +}; diff --git a/static/README.md b/static/README.md index a65325188b..b9978c4762 100644 --- a/static/README.md +++ b/static/README.md @@ -1,7 +1,6 @@ # πŸ“– Baca-Quran.id ![Svelte Kit](https://img.shields.io/badge/SvelteKit-TypeScript-blue.svg) -[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg)](#contributors) [![Codecov](https://codecov.io/gh/mazipan/baca-quran.id/branch/master/graph/badge.svg)](https://codecov.io/gh/mazipan/baca-quran.id) ![Last Deployed](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.baca-quran.id%2Ftimestamp.json) @@ -29,8 +28,20 @@ Read Qur'an from Your Web Browser. No Ads, No Analytics, It's Totally Free. ## Local Setup +### Requirement + +- Node v20 (use [nvm](https://github.com/nvm-sh/nvm) or other version manager) +- pnpm v9: https://pnpm.io/installation + +### Install Dependencies + ```bash pnpm i +``` + +### Run in your local + +```bash pnpm run dev ``` @@ -42,27 +53,15 @@ pnpm run build Copy `build` folder to your hosting. -## Baca-Quran V1 - -V1 can be viewed in [`v1`](https://github.com/mazipan/baca-quran.id/tree/v1) branch. - -### Screenshots V1 +## Credits -| Light | Blueish | Nature | -| :------------------------------: | :----------------------------: | :--------------------------------: | -| ![light](screenshoot/tlight.png) | ![dark](screenshoot/tblue.png) | ![nature](screenshoot/tnature.png) | - -| Asmaul Husna | Al-Fatihah | Do'a Harian | -| :-------------------------------------------: | :---------------------------------------: | :---------------------------------------: | -| ![asmaul husna](screenshoot/asmaul-husna.png) | ![al-fatihah](screenshoot/al-fatihah.png) | ![doa harian](screenshoot/doa-harian.png) | - -## Credit - -- Thanks for awesome repo [quran-json](https://github.com/rioastamal/quran-json) by [@rioastamal](https://github.com/rioastamal) -- Asmaul Husna source from [islam.nu.or.id](https://islam.nu.or.id/ubudiyah/99-asmaul-husna-dan-artinya-1T8jl) -- Daily Do'a from [doaharianislami.com](http://www.doaharianislami.com/2017/06/kumpulan-doa-sehari-hari-lengkap-dalam-bahasa-arab-latin-dan-artinya.html) -- MP3 Audio from [kemenag.go.id](https://quran.kemenag.go.id/) -- Tahlil from [islam.nu.or.id](https://islam.nu.or.id/post/read/107344/susunan-bacaan-tahlil-doa-arwah-lengkap-dan-terjemahannya) +- [quran-json](https://github.com/rioastamal/quran-json) by [@rioastamal](https://github.com/rioastamal) +- Asmaul Husna: from [islam.nu.or.id](https://islam.nu.or.id/ubudiyah/99-asmaul-husna-dan-artinya-1T8jl) +- Daily Do'a: from [doaharianislami.com](http://www.doaharianislami.com/2017/06/kumpulan-doa-sehari-hari-lengkap-dalam-bahasa-arab-latin-dan-artinya.html) +- MP3 Audio: from [kemenag.go.id](https://quran.kemenag.go.id/) +- Tahlil: from [islam.nu.or.id](https://islam.nu.or.id/post/read/107344/susunan-bacaan-tahlil-doa-arwah-lengkap-dan-terjemahannya) +- Reverse Geolocation: [nominatim](https://nominatim.openstreetmap.org) +- Prayer Schedule: from [api.aladhan.com](https://api.aladhan.com) ## Icons & Backgrounds @@ -79,16 +78,12 @@ V1 can be viewed in [`v1`](https://github.com/mazipan/baca-quran.id/tree/v1) bra - πŸ‘‰ 🌍 [Paypal](https://www.paypal.me/mazipan?utm_source=github-mazipan) - πŸ‘‰ 🌍 [Ko-Fi](https://ko-fi.com/mazipan?utm_source=github-mazipan) ---- - -Copyright Β© 2018 by Irfan Maulana - ## Contributors Thanks goes to these wonderful people - - [![Contributors](https://contrib.rocks/image?repo=mazipan/baca-quran.id)](https://github.com/mazipan/baca-quran.id/graphs/contributors) - +--- + +Copyright Β© 2018-present by Irfan Maulana