Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from mazipan:master #83

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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=
7 changes: 0 additions & 7 deletions .env.production

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/. ./
Expand Down
51 changes: 23 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
```

Expand All @@ -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

Expand All @@ -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

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

[![Contributors](https://contrib.rocks/image?repo=mazipan/baca-quran.id)](https://github.com/mazipan/baca-quran.id/graphs/contributors)

<!-- ALL-CONTRIBUTORS-LIST:END -->
---

Copyright © 2018-present by Irfan Maulana
3 changes: 2 additions & 1 deletion scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export const staticUrls = [
'/sync/',
'/tahlil/',
'/tasbih/',
'/wirid/'
'/wirid/',
'/pencatat-ibadah/'
];
15 changes: 5 additions & 10 deletions src/lib/PrayerTimeCard.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<script lang="ts">
import CardShadow from './CardShadow.svelte';
import type { PrayerKey, PrayerTimings } from './types';
import dayjs from 'dayjs';
import relativeTime from "dayjs/plugin/relativeTime";
import duration from "dayjs/plugin/duration";
import 'dayjs/locale/id'
import { onMount } from 'svelte';
import { getDayjs, getDayjsFormatted, getMinuteDuration } from '$lib/utils/date';

import { activeTheme } from '../store';

dayjs.locale('id')
dayjs.extend(relativeTime);
dayjs.extend(duration);

interface Props {
timings?: PrayerTimings | null;
prayerKey: PrayerKey;
Expand All @@ -23,14 +18,14 @@
let durationText: string = $state('');

onMount(async () => {
const now = dayjs();
const now = getDayjs();
const timeStr = `${timings?.[prayerKey] || ''}`.substring(0, 5);

const prayerTime = dayjs(`${now.format('YYYY-MM-DD')} ${timeStr}`, 'YYYY-MM-DD HH:mm');
const prayerTime = getDayjsFormatted(`${now.format('YYYY-MM-DD')} ${timeStr}`, 'YYYY-MM-DD HH:mm');

const diffTime = prayerTime.diff(now, 'minute');
isPast = diffTime < 0;
durationText = dayjs.duration(diffTime, "minutes").humanize(true);
durationText = getMinuteDuration(diffTime);
});

</script>
Expand Down
12 changes: 10 additions & 2 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const CONSTANTS = {
LAST_VERSES: 'vres',
LOCATION: 'loc',
PRAYER: 'pryr',
THEME: 'theme'
THEME: 'theme',
LOG_PRAYER: 'log'
},
BISMILLAH: '﷽'
};
Expand Down Expand Up @@ -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)}`;
Expand All @@ -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,
Expand All @@ -117,7 +122,8 @@ export type PageVariant =
| 'TASBIH'
| 'MAKKIYAH'
| 'MADANIYAH'
| 'JADWAL_SHOLAT';
| 'JADWAL_SHOLAT'
| 'CATAT_IBADAH';

export const SEO_TEXT = {
ALL_SURAH:
Expand All @@ -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: ''
};
Expand Down
2 changes: 2 additions & 0 deletions src/lib/utils/array.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const range = (start: number, stop: number, step = 1) =>
Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step)
40 changes: 40 additions & 0 deletions src/lib/utils/date.ts
Original file line number Diff line number Diff line change
@@ -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);
};
11 changes: 10 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
settingAutoNext,
pinnedSurah,
lastReadVerses,
settingLocation
settingLocation,
logPrayer,
} from '../store';

import '../app.css';
Expand Down Expand Up @@ -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);
}
}
}
});
Expand Down
4 changes: 4 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
{
href: '/jadwal-sholat/',
title: '⏰ Jadwal Sholat'
},
{
href: '/pencatat-ibadah/',
title: '⏺️ Pencatat Ibadah'
}
];
</script>
Expand Down
Loading