diff --git a/.eslintrc.json b/.eslintrc.json index a690512..3fec71c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,12 @@ { - "extends": ["next/core-web-vitals", "plugin:prettier/recommended"] + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "next/core-web-vitals", + "plugin:prettier/recommended" + ], + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error"] + } } diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..bae6b83 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @slowy07 @abnvlf \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..2f73ad7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,44 @@ +--- +name: Bug report +about: Buat laporan untuk membantu kami memperbaiki +title: "[BUG] " +labels: bug +assignees: abnvlf +--- + +## Deskripsikan Bug + + + +## Untuk Reproduce Issue + + + +## Perilaku yang Diharapkan + + + +## Tangkapan Layar + + + +## Desktop (tolong lengkapi informasi berikut) + +- OS: [contoh: iOS] +- Browser [contoh: chrome, safari] +- Versi [contoh: 22] + +## Smartphone (tolong lengkapi informasi berikut) + +- Perangkat: [contoh: iPhone6] +- OS: [contoh: iOS8.1] +- Browser [contoh: browser bawaan, safari] +- Versi [contoh: 22] + +## Konteks Tambahan + +Tambahkan konteks tambahan tentang masalah di sini. diff --git a/.github/ISSUE_TEMPLATE/contribute-request.md b/.github/ISSUE_TEMPLATE/contribute-request.md new file mode 100644 index 0000000..6fdc318 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/contribute-request.md @@ -0,0 +1,11 @@ +--- +name: Contribute Request +about: "Ajukan ide untuk berkontribusi proyek ini " +title: "[CONTRIBUTE] " +labels: enhancement +assignees: "" +--- + +## Deskripsi Perubahan + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..ca1156c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Ajukan ide untuk proyek ini +title: "[REQUEST] " +labels: enhancement +assignees: abnvlf +--- + +## Apakah permintaan fitur Anda terkait dengan masalah? Silakan deskripsikan + + + +## Deskripsikan solusi yang Anda inginkan + + + +## Deskripsikan alternatif yang telah Anda pertimbangkan + + + +## Konteks Tambahan + + diff --git a/.github/banner.png b/.github/banner.png new file mode 100644 index 0000000..e9dfba4 Binary files /dev/null and b/.github/banner.png differ diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..82709ad --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,41 @@ +# Penambahan / Perubahan / Perbaikan Fitur [Nama Fitur] + +## Deskripsi + + + +## Screenshot Hasil Perubahan + + + +## Checklist + + + +### Contributor Requirements (Syarat Kontributor) dan Lain-Lain + +- [ ] Saya sudah membaca [CONTRIBUTING](https://github.com/bellshade/OpenSeries/blob/main/CONTRIBUTING.md) dan sudah menyetujui semua syarat. +- [ ] Saya menggunakan bahasa Indonesia untuk memberikan penjelasan dari kode yang saya buat. + +### Formatting dan Linting + + + +- [ ] prettier +- [ ] eslint +- [ ] markdownlint + +## Environment + +Saya menggunakan: + + + +- `os` = `linux / windows / macOS` +- `bun` = `cek menggunakan bun -v` + + + + + +linked issue #NOMOR_ISSUE diff --git a/.github/workflows/build-openseries-web.yaml b/.github/workflows/build-openseries-web.yaml new file mode 100644 index 0000000..9cc3dd3 --- /dev/null +++ b/.github/workflows/build-openseries-web.yaml @@ -0,0 +1,69 @@ +name: Build OpenSeries Web + +on: + pull_request: + branches: + - develop + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Build Next.js + run: | + bun install --frozen-lockfile + bun lint + bun run build + + - name: Check Build Status + run: | + if [ $? -eq 0 ]; then + echo "Build successful" + else + echo "Build failed. Exiting..." + exit 1 + fi + + comment: + needs: build + runs-on: ubuntu-latest + if: always() + steps: + - name: Comment on Pull Request + env: + GH_TOKEN: ${{ secrets.WF_TOKEN }} + PR: ${{ github.event.pull_request.html_url }} + run: | + LAST_COMMIT_SHA="${{ github.event.pull_request.head.sha }}" + if [ ${{ needs.build.result }} == 'success' ]; then + BUILD_STATUS="Berhasil🩵" + LABEL="ready to review" + SUCCESS_MESSAGE="Mohon untuk menunggu para Maintainer mereview kodemu🎉!" + REMOVAL_LABEL="invalid" + else + BUILD_STATUS="Gagal💔" + LABEL="invalid" + SUCCESS_MESSAGE="Sepertinya ada kesalahan dalam kode yang menyebabkan kegagalan build. Coba jalankan \`bun run build\` di localmu. Silahkan perbaiki terlebih dahulu😼!" + REMOVAL_LABEL="ready to review" + fi + COMMENT_BODY=$(cat < [!NOTE] +> Ini adalah repository untuk **Website OpenSeries.** Jika Anda ingin berkontribusi pada **Library OpenSeries**, silakan kunjungi [Repositori OpenSeries](https://github.com/bellshade/OpenSeries/). -Proyek ini menggunakan Next.js sebagai framework, serta Bun sebagai package manager dan runtime. Pastikan Anda telah menginstal Bun sebelum memulai. +Project ini menggunakan [Next.js](https://nextjs.org/) sebagai framework untuk membangun website OpenSeries, serta [Bun](https://bun.sh/) sebagai package manager dan JavaScript runtime environment. + +## Daftar isi + +- [Ketentuan Kontribusi](#ketentuan-kontribusi) +- [Langkah-Langkah Kontribusi](#langkah-langkah-kontribusi) +- [Format Pesan Commit](#format-pesan-commit) +- [Proses Review dan Merge](#proses-review-dan-merge) ## Ketentuan Kontribusi -- Hasil pekerjaan Anda harus merupakan buatan sendiri dan bebas dari hak cipta orang lain. Kesamaan dengan karya orang lain tidak akan kami merge. -- Setiap pull request yang di-merge akan dilisensikan di bawah lisensi MIT. -- Pekerjaan Anda harus mengikuti standar dan gaya penulisan kode yang telah ditetapkan. +- Setiap kontribusi harus merupakan karya sendiri dan tidak melanggar hak cipta orang lain. kontribusi yang menyalin karya orang lain tidak akan kami merge. +- Setiap pull request yang di-merge akan dilisensikan di bawah [Lisensi MIT](https://github.com/bellshade/OpenSeriesWeb/blob/main/LICENSE). +- Pekerjaan Anda harus mengikuti standar dan gaya penulisan kode yang telah ditetapkan. ## Langkah-Langkah Kontribusi -1. Fork repository ini. -2. Clone repository yang sudah di-fork ke lokal Anda: +1. Sebelum Anda mulai membuat perubahan, perbaikan, atau menambah fitur, silakan untuk **membuat [issue](https://github.com/bellshade/OpenSeriesWeb/issues/new)** terlebih dahulu. Hal ini akan membantu mencegah konflik dengan pull request lainnya. Anda dapat menjelaskan detail perubahan yang akan Anda lakukan dengan membuat deskripsi di [issue](https://github.com/bellshade/OpenSeriesWeb/issues/new). Setelah Anda menjelaskan perubahan Anda di [issue](https://github.com/bellshade/OpenSeriesWeb/issues/new), Anda dapat melakukan fork terhadap repositori kami. + +2. Clone repository yang sudah di-fork ke perangkat lokal Anda: ```bash git clone https://github.com/username/OpenSeriesWeb.git ``` - Ganti `username` degan username Anda. -3. Masuk ke folder hasil clone, lalu pindahkan branch ke branch `develop`: + Ubah `username` degan username Github Anda. + +3. Masuk ke direktori project, lalu pindah ke branch `develop`: ```bash git checkout develop ``` 4. Setup pre-commit - - Install sesuai panduan resmi di [website pre-commit](https://pre-commit.com/#install) + + - Ikuti panduan resmi mengenai instalasi di [website pre-commit](https://pre-commit.com/#install) - Jalankan `pre-commit install` -5. Buat branch baru sesuai fitur atau perbaikan yang akan Anda tambahkan: + +5. Buat branch baru sesuai perubahan atau perbaikan yang ingin Anda tambahkan: ```bash git checkout -b nama-branch ``` -6. Jalankan website menggunakan `bun dev`: +6. Mulailah membuat perubahan atau perbaikan yang diinginkan. + +7. Jalankan project secara lokal untuk menguji perubahan Anda dengan perintah: ```bash bun dev ``` -7. Lakukan perbaikan atau penambahan pada website. -8. Jika semua sudah sesuai, lakukan commit dan push perubahan Anda. -9. Lakukan pull request ke branch `develop` di reposotory ini. + Anda dapat mengakses website OpenSeries yang berjalan secara lokal melalui URL [http://localhost:3000](http://localhost:3000) + +8. Jika semua sudah sesuai, tambahkan perubahan yang telah Anda lakukan ke dalam staging area dengan perintah berikut: + + ```bash + git add . + ``` + +9. Setelah selesai, buatlah pesan commit yang sesuai dengan [format yang sudah di tentukan](#format-pesan-commit). -## Pesan Commit +10. Push commit anda kedalam branch yang Anda buat sebelumnya: -Gunakan format berikut sesuai dengan [Conventional Commits](https://www.conventionalcommits.org/id/v1.0.0/): + ```bash + git push origin nama-branch + ``` -- `feat:` untuk penambahan fitur baru. -- `fix:` untuk memperbaiki bug. -- `docs:` untuk mengubah dokumentasi. -- `add:` untuk menambahkan konten atau file baru. +11. Buatlah Pull Request ke branch `develop` pada [repositori utama](https://github.com/bellshade/OpenSeriesWeb) melalui _interface_ Github. + +## Format Pesan Commit + +Kami sangat menghargai penggunaan format commit yang konsisten untuk memudahkan pemantauan dan pemeliharaan project. Mohon gunakan format berikut sesuai dengan [Conventional Commits](https://www.conventionalcommits.org/id/v1.0.0/): + +- `feat:` untuk menandai penambahan fitur baru. +- `fix:` untuk menandai perbaikan bug. +- `docs:` untuk menandai perubahan dalam dokumentasi. +- `add:` untuk menandai penambahan konten atau file baru. Contoh: ```bash -git commit -m "feat: Menambah fitur baru untuk ..." +git commit -m "feat: Menambahkan fitur search pada halaman dokumentasi." ``` +Mohon pastikan pesan commit Anda jelas dan deskriptif untuk memudahkan proses review dan integrasi. + ## Proses Review dan Merge -Pull request Anda akan di-merge jika: +Pull Request Anda akan di-merge jika: -- Mengikuti standar dan arahan dari CONTRIBUTING.md. -- Lolos uji dan pemeriksaan dari tes yang telah kami sediakan. +- Mengikuti standar dan petunjuk dari CONTRIBUTING.md. +- Lulus uji dan pemeriksaan dari tes yang telah kami sediakan. -Jika ada pertanyaan atau masalah, jangan ragu untuk mengajukan issue atau menghubungi tim pengembangan. +Jika Anda memiliki pertanyaan atau mengalami masalah, jangan ragu untuk membuka [issue](https://github.com/bellshade/OpenSeriesWeb/issues) atau menghubungi tim pengembangan. Terima kasih atas kontribusi Anda! diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4d19f43 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Bellshade + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 386cc0a..8d87ece 100644 --- a/README.md +++ b/README.md @@ -1,84 +1,56 @@ -# Website OpenSeries +

Website OpenSeries

-Selamat datang di repositori OpenSeries! Repositori ini berisi kode sumber untuk website OpenSeries. Kami menggunakan runtime dan package manager dari Bun, jadi jika Anda ingin berkontribusi, pastikan untuk menginstal Bun terlebih dahulu dengan mengacu pada dokumentasi resmi di [website bun](https://bun.sh/). +![Banner](.github/banner.png) -## Memulai +

Selamat datang di repositori OpenSeriesWeb! Repositori ini berisi kode sumber untuk website OpenSeries.

-Untuk berkontribusi pada website OpenSeries, ikuti langkah-langkah berikut: +

+ Website - Depedensi - Instalasi - Kontribusi - Lisensi +

-1. Fork repositori ini di GitHub. +## Depedensi -2. Clone repositori yang telah di-fork ke mesin lokal Anda: +- [Bun](https://bun.sh/): Package manager dan JavaScript runtime environment yang digunakan untuk mengelola dependensi project. +- [Next.js](https://nextjs.org/): Framework React yang digunakan untuk membangun website OpenSeries. +- [Prettier](https://prettier.io/): Alat yang digunakan untuk memformat kode secara otomatis sesuai dengan aturan yang telah ditentukan. +- [ESLint](https://eslint.org/): Alat linting JavaScript yang digunakan untuk menganalisis kode JavaScript dan menemukan masalah potensial. +- [TailwindCSS](https://tailwindcss.com/): Framework CSS yang digunakan untuk mengatur tampilan website. - ```bash - git clone https://github.com/nama-anda/OpenSeries.git - ``` +## Instalasi -3. Pindah ke direktori proyek: +Tata cara untuk menjalankan website OpenSeries secara lokal: - ```bash - cd OpenSeries - ``` +1. Pastikan bahwa **Bun** telah ter-install di perangkat Anda. Lihat dokumentasi resmi Bun untuk [tata cara instalasinya](https://bun.sh/docs/installation) -4. Pastikan branch Anda diatur ke `develop`: +2. Clone repositori ini ke perangkat lokal Anda: ```bash - git checkout develop + git clone https://github.com/bellshade/OpenSeriesWeb.git ``` -5. Buat branch baru untuk fitur atau perbaikan bug: +3. Masuk ke direktori project: ```bash - git checkout -b nama-fitur + cd OpenSeriesWeb ``` -## Alur Pengembangan - -1. Instal paket yang diperlukan menggunakan Bun: +4. Install depedensi project yang diperlukan: ```bash bun install ``` -2. Jalankan proyek menggunakan Bun: - +5. Jalankan project secara lokal: ```bash bun dev ``` -3. Sebelum melakukan commit, jalankan linter Bun untuk memastikan kualitas kode: - - ```bash - bun lint - ``` - -4. Format kode menggunakan Bun Prettier: - - ```bash - bun format - ``` - -5. Lakukan commit perubahan Anda dengan menggunakan salah satu awalan pesan commit berikut: - - - `feat:` untuk fitur baru - - `fix:` untuk perbaikan bug - - `docs:` untuk perubahan dokumentasi - - `add:` untuk menambahkan file atau aset - - Contoh commit: - - ```bash - git commit -m "feat: menambahkan fitur baru" - ``` - -## Pull Request - -Setelah membuat perubahan, dorong branch ke fork Anda di GitHub dan buat pull request yang dituju ke branch develop repositori ini. +Anda dapat mengakses website OpenSeries yang berjalan secara lokal melalui URL [http://localhost:3000](http://localhost:3000) -## Kontributor +## Kontribusi -Terima kasih kepada semua kontributor yang telah membantu meningkatkan website OpenSeries! Jika Anda tertarik berkontribusi, silakan fork repositori ini dan kirim pull request ke branch develop. +Jika Anda tertarik untuk berkontribusi pada project ini, Silahkan membaca [CONTRIBUTING.md](https://github.com/bellshade/OpenSeriesWeb/blob/main/CONTRIBUTING.md) untuk panduan dan langkah-langkah yang harus diikuti sebelum berkontribusi. ## Lisensi -Proyek ini dilisensikan di bawah Lisensi MIT. +Project ini dilisensikan di bawah [Lisensi MIT](https://github.com/bellshade/OpenSeriesWeb/blob/main/LICENSE). Lihat `LICENSE` untuk informasi lebih lanjut. diff --git a/app.d.ts b/app.d.ts deleted file mode 100644 index a1b83c1..0000000 --- a/app.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module "vanta/dist/vanta.globe.min"; diff --git a/app/(landing)/layout.tsx b/app/(landing)/layout.tsx index 3298b63..56c0d54 100644 --- a/app/(landing)/layout.tsx +++ b/app/(landing)/layout.tsx @@ -1,14 +1,15 @@ "use client"; -import { useNavStyle } from "@/hooks/useNavStyle"; import { ReactNode, useEffect } from "react"; +import { useNavStyleStore } from "@/stores/use-nav-style-store"; + type Props = { children: ReactNode; }; const Layout = ({ children }: Props) => { - const { setLandingStyles } = useNavStyle(); + const { setLandingStyles } = useNavStyleStore(); useEffect(() => { setLandingStyles(); diff --git a/app/(landing)/page.tsx b/app/(landing)/page.tsx index 587038c..6e9c9e6 100644 --- a/app/(landing)/page.tsx +++ b/app/(landing)/page.tsx @@ -1,53 +1,53 @@ "use client"; import Link from "next/link"; -import { projectByLinks } from "@/constants/projectByLinks"; -import LandingSvg from "@/components/LandingSvg"; + +import { projectByLinks } from "@/constants/project-by-links"; + +import LandingSvg from "@/components/landing-svg"; export default function Home() { return ( - <> -
-
-
-

- - OpenSeries:{" "} - - Cheatsheet Matematika & Fisika -

-

- Solusi Pintar untuk Hitung-Hitung Sekolah! Temukan kemudahan mengatasi segala jenis - persamaan dan rumus di bangku SMA/SMK/Sederajat. -

-
- - Get Started - - - By - {projectByLinks.map((link) => ( - - {link.name} - - ))} - -
+
+
+
+

+ + OpenSeries:{" "} + + Cheatsheet Matematika & Fisika +

+

+ Solusi Pintar untuk Hitung-Hitung Sekolah! Temukan kemudahan mengatasi segala jenis persamaan + dan rumus di bangku SMA/SMK/Sederajat. +

+
+ + Get Started + + + By + {projectByLinks.map((link) => ( + + {link.name} + + ))} +
-
-
- + +
+
); } diff --git a/app/docs/bilangan/bilangan-armstrong/page.mdx b/app/docs/bilangan/bilangan-armstrong/page.mdx index 91235f0..253b2e0 100644 --- a/app/docs/bilangan/bilangan-armstrong/page.mdx +++ b/app/docs/bilangan/bilangan-armstrong/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Bilangan Armstrong diff --git a/app/docs/bilangan/bilangan-automorphic/page.mdx b/app/docs/bilangan/bilangan-automorphic/page.mdx index eb44d73..260869b 100644 --- a/app/docs/bilangan/bilangan-automorphic/page.mdx +++ b/app/docs/bilangan/bilangan-automorphic/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Angka Automorphic diff --git a/app/docs/bilangan/bilangan-pronic/page.mdx b/app/docs/bilangan/bilangan-pronic/page.mdx index a622981..27032a8 100644 --- a/app/docs/bilangan/bilangan-pronic/page.mdx +++ b/app/docs/bilangan/bilangan-pronic/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Bilangan Pronic diff --git a/app/docs/bilangan/bilangan-segitiga/page.mdx b/app/docs/bilangan/bilangan-segitiga/page.mdx index 44997a1..0619428 100644 --- a/app/docs/bilangan/bilangan-segitiga/page.mdx +++ b/app/docs/bilangan/bilangan-segitiga/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Bilangan Segitiga diff --git a/app/docs/changelog/page.tsx b/app/docs/changelog/page.tsx new file mode 100644 index 0000000..019d3cf --- /dev/null +++ b/app/docs/changelog/page.tsx @@ -0,0 +1,17 @@ +import { MDXRemote } from "next-mdx-remote/rsc"; + +import { octokit } from "@/constants/octokit"; + +const Page = async () => { + const { data } = await octokit.request("GET /repos/{owner}/{repo}/releases/latest", { + owner: "bellshade", + repo: "OpenSeries", + headers: { + "X-GitHub-Api-Version": "2022-11-28" + } + }); + + return ; +}; + +export default Page; diff --git a/app/docs/fisika/efek-doppler/page.mdx b/app/docs/fisika/efek-doppler/page.mdx index 8c3c688..e03da44 100644 --- a/app/docs/fisika/efek-doppler/page.mdx +++ b/app/docs/fisika/efek-doppler/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Efek Doppler diff --git a/app/docs/fisika/energi-kinetik/page.mdx b/app/docs/fisika/energi-kinetik/page.mdx index da19601..5a4e354 100644 --- a/app/docs/fisika/energi-kinetik/page.mdx +++ b/app/docs/fisika/energi-kinetik/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Energi Kinetik diff --git a/app/docs/fisika/energi-potensial/page.mdx b/app/docs/fisika/energi-potensial/page.mdx index d289d4a..31bdbfc 100644 --- a/app/docs/fisika/energi-potensial/page.mdx +++ b/app/docs/fisika/energi-potensial/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Energi Potensial diff --git a/app/docs/fisika/gaya-sentripetal/page.mdx b/app/docs/fisika/gaya-sentripetal/page.mdx index 8e71910..153fdf9 100644 --- a/app/docs/fisika/gaya-sentripetal/page.mdx +++ b/app/docs/fisika/gaya-sentripetal/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Gaya Sentripetal diff --git a/app/docs/fisika/hukum-ohm/page.mdx b/app/docs/fisika/hukum-ohm/page.mdx index f15ba41..1a83c42 100644 --- a/app/docs/fisika/hukum-ohm/page.mdx +++ b/app/docs/fisika/hukum-ohm/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Hukum Ohm diff --git a/app/docs/fisika/kecepatan/page.mdx b/app/docs/fisika/kecepatan/page.mdx index 82d44fc..5b9b053 100644 --- a/app/docs/fisika/kecepatan/page.mdx +++ b/app/docs/fisika/kecepatan/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Kecepatan diff --git a/app/docs/fisika/masa-jenis/page.mdx b/app/docs/fisika/masa-jenis/page.mdx deleted file mode 100644 index aba1623..0000000 --- a/app/docs/fisika/masa-jenis/page.mdx +++ /dev/null @@ -1,46 +0,0 @@ -import Codeblock from "@/components/Codeblock"; - -# Massa Jenis - -Massa jenis adalah besarnya massa zat setiap satuan volume. Massa jenis setiap benda itu bersifat spesifik atau berbeda-beda dan tetap. -Misalnya massa jenis satu sendok air sama dengan massa jenis satu gelas air dan massa jenis air berbeda dengan massa jenis zat yang lain. Semakin rapat susunan partikel di dalam suatu zat, semakin besar pula massa tiap satuan volumenya. -Artinya, massa jenisnya semakin besar atau disebut kerapatan tinggi. Semakin renggang susunan partikel di dalam zat, semakin kecil massa tiap satuan volumenya. Artinya, massa jenis semakin kecil atau disebut kerapatan rendah. Umumnya, massa jenis besar dimiliki oleh zat padat seperti logam. Sementara massa jenis kecil dimiliki oleh gas. - -Rumus: - -``` -ρ = m / V -``` - -ket: - -ρ = massa jenis (kg/m3 atau gr/cm3)
-m = massa (kg atau gr)
-V = volume (m3 atau cm3) - -Fungsi [sumber kode [disini](https://github.com/bellshade/OpenSeries/blob/main/OpenSeries/fisika.py#L94)] - -```python -def masa_jenis( - massa: Union[int, float], volume: Union[int, float] -) -> Union[int, float, str]: -``` - -Contoh Kode - -```python -import OpenSeries.fisika as fisika - -massa_benda = 14 -volume_benda = 8 -print(fisika.masa_jenis(massa_benda, volume_benda)) -``` - -## Coba Sekarang - - diff --git a/app/docs/fisika/massa-jenis/page.mdx b/app/docs/fisika/massa-jenis/page.mdx index aba1623..9ad2731 100644 --- a/app/docs/fisika/massa-jenis/page.mdx +++ b/app/docs/fisika/massa-jenis/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Massa Jenis diff --git a/app/docs/fisika/percepatan/page.mdx b/app/docs/fisika/percepatan/page.mdx index df9fd9d..12bd82e 100644 --- a/app/docs/fisika/percepatan/page.mdx +++ b/app/docs/fisika/percepatan/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Percepatan diff --git a/app/docs/fisika/tekanan-barometrik/page.mdx b/app/docs/fisika/tekanan-barometrik/page.mdx index e524763..5b7bec7 100644 --- a/app/docs/fisika/tekanan-barometrik/page.mdx +++ b/app/docs/fisika/tekanan-barometrik/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Tekanan Barometrik diff --git a/app/docs/get-started/tentang/page.mdx b/app/docs/get-started/tentang/page.mdx new file mode 100644 index 0000000..bf97254 --- /dev/null +++ b/app/docs/get-started/tentang/page.mdx @@ -0,0 +1,9 @@ +# OpenSeries + +![OpenSeries Banner](/assets/img/banner.png) + +OpenSeries adalah sebuah proyek yang bertujuan untuk membantu siswa dalam menghitung segala jenis persamaan dan rumus yang umumnya ditemui di bangku sekolah menengah atas (SMA/SMK/sederajat). Dengan OpenSeries, siswa dapat dengan mudah menyelesaikan permasalahan matematika dan ilmu pengetahuan lainnya dengan cepat dan efisien. + +Proyek ini merupakan bagian dari inisiatif Bellshade, sebuah organisasi pendidikan yang berkomitmen untuk menyediakan sumber daya terbuka (open source) bagi masyarakat. Bellshade dikelola oleh komunitas Web Programming UNPAS (WPU) dan berupaya untuk menyebarkan pengetahuan secara luas dalam bidang teknologi. + +Nama "Bellshade" sendiri memiliki makna yang dalam. Dalam bahasa Inggris, "bellshade" berarti "penutup lampu belajar", yang menggambarkan tujuan kami untuk menyediakan arahan dan pencerahan bagi mereka yang mencari ilmu. Kami percaya bahwa dengan menyebarkan pengetahuan, kita dapat menerangi jalan menuju kesuksesan bagi banyak orang, terutama di bidang teknologi. diff --git a/app/docs/community/page.mdx b/app/docs/komunitas/page.mdx similarity index 95% rename from app/docs/community/page.mdx rename to app/docs/komunitas/page.mdx index 2dc76cc..1157f6c 100644 --- a/app/docs/community/page.mdx +++ b/app/docs/komunitas/page.mdx @@ -1,4 +1,4 @@ -import Community from "@/components/Community"; +import Community from "@/components/community"; # Komunitas diff --git a/app/docs/contribute/page.mdx b/app/docs/kontribusi/page.mdx similarity index 91% rename from app/docs/contribute/page.mdx rename to app/docs/kontribusi/page.mdx index 84e191f..888fc7d 100644 --- a/app/docs/contribute/page.mdx +++ b/app/docs/kontribusi/page.mdx @@ -1,5 +1,5 @@ -import Contribute from "@/components/Contribute"; -import Contributors from "@/components/Contributors"; +import Contribute from "@/components/contribute"; +import Contributors from "@/components/contributors"; # Kontribusi diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx index 0b99065..ab4168b 100644 --- a/app/docs/layout.tsx +++ b/app/docs/layout.tsx @@ -1,26 +1,15 @@ -"use client"; +import { ReactNode } from "react"; -import Sidebar from "@/components/Sidebar"; -import { useNavStyle } from "@/hooks/useNavStyle"; -import { useEffect } from "react"; -import { PythonProvider } from "react-py"; +import { sidebarLinks } from "@/constants/sidebar-links"; -export default function MdxLayout({ children }: { children: React.ReactNode }) { - const { setDocsStyle } = useNavStyle(); - const packages = { - micropip: ["OpenSeriesBellshade"] - }; - - useEffect(() => { - setDocsStyle(); - }, [setDocsStyle]); +import DocsWrapper from "@/components/docs-wrapper"; +import Sidebar from "@/components/sidebar"; +export default async function MdxLayout({ children }: { children: ReactNode }) { return ( - - -
- {children} -
-
+ <> + + {children} + ); } diff --git a/app/docs/matematika/diameter-lingkaran/page.mdx b/app/docs/matematika/diameter-lingkaran/page.mdx index 7c07f44..e08c2b2 100644 --- a/app/docs/matematika/diameter-lingkaran/page.mdx +++ b/app/docs/matematika/diameter-lingkaran/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Diameter Lingkaran diff --git a/app/docs/matematika/distribusi-binomial/page.mdx b/app/docs/matematika/distribusi-binomial/page.mdx index 4f28d88..bf47acc 100644 --- a/app/docs/matematika/distribusi-binomial/page.mdx +++ b/app/docs/matematika/distribusi-binomial/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Distribusi Binomial diff --git a/app/docs/matematika/faktor-prima/page.mdx b/app/docs/matematika/faktor-prima/page.mdx index f040768..d231f29 100644 --- a/app/docs/matematika/faktor-prima/page.mdx +++ b/app/docs/matematika/faktor-prima/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Faktor Prima diff --git a/app/docs/matematika/faktorial/page.mdx b/app/docs/matematika/faktorial/page.mdx index cbf861e..36bbda0 100644 --- a/app/docs/matematika/faktorial/page.mdx +++ b/app/docs/matematika/faktorial/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Faktorial diff --git a/app/docs/matematika/fpb/page.mdx b/app/docs/matematika/fpb/page.mdx index 03dbedc..9794468 100644 --- a/app/docs/matematika/fpb/page.mdx +++ b/app/docs/matematika/fpb/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Faktor Persekutuan Terbesar diff --git a/app/docs/matematika/integral/page.mdx b/app/docs/matematika/integral/page.mdx index ac0218c..9b9f5ed 100644 --- a/app/docs/matematika/integral/page.mdx +++ b/app/docs/matematika/integral/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Integral diff --git a/app/docs/matematika/keliling-lingkaran/page.mdx b/app/docs/matematika/keliling-lingkaran/page.mdx index 1af1c2a..a0aaa72 100644 --- a/app/docs/matematika/keliling-lingkaran/page.mdx +++ b/app/docs/matematika/keliling-lingkaran/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Keliling Lingkaran diff --git a/app/docs/matematika/luas-lingkaran/page.mdx b/app/docs/matematika/luas-lingkaran/page.mdx index b2b2f60..e25fe74 100644 --- a/app/docs/matematika/luas-lingkaran/page.mdx +++ b/app/docs/matematika/luas-lingkaran/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Luas Lingkaran diff --git a/app/docs/matematika/peluang-kejadian/page.mdx b/app/docs/matematika/peluang-kejadian/page.mdx index cdf81a2..8807796 100644 --- a/app/docs/matematika/peluang-kejadian/page.mdx +++ b/app/docs/matematika/peluang-kejadian/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Peluang Kejadian diff --git a/app/docs/matematika/persamaan-kuadrat/page.mdx b/app/docs/matematika/persamaan-kuadrat/page.mdx index 08cfb93..1f9f208 100644 --- a/app/docs/matematika/persamaan-kuadrat/page.mdx +++ b/app/docs/matematika/persamaan-kuadrat/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Persamaan Kuadrat diff --git a/app/docs/matematika/radian-ke-derajat/page.mdx b/app/docs/matematika/radian-ke-derajat/page.mdx index b6ea885..875d7b8 100644 --- a/app/docs/matematika/radian-ke-derajat/page.mdx +++ b/app/docs/matematika/radian-ke-derajat/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Radian ke Derajat diff --git a/app/docs/matematika/sigmoid/page.mdx b/app/docs/matematika/sigmoid/page.mdx index 219dca9..f2c859a 100644 --- a/app/docs/matematika/sigmoid/page.mdx +++ b/app/docs/matematika/sigmoid/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Sigmoid diff --git a/app/docs/matematika/turunan/page.mdx b/app/docs/matematika/turunan/page.mdx index 4e5bc5d..d6e1afd 100644 --- a/app/docs/matematika/turunan/page.mdx +++ b/app/docs/matematika/turunan/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Derivative (Turunan) diff --git a/app/docs/page.mdx b/app/docs/page.mdx deleted file mode 100644 index db9ab13..0000000 --- a/app/docs/page.mdx +++ /dev/null @@ -1,5 +0,0 @@ -# OpenSeries - -![image_banner](https://raw.githubusercontent.com/bellshade/OpenSeries/develop-library/.github/openSeries.png) - -Project Untuk Menghitung Segala Jenis Persamaan atau Rumus-Rumus yang terdapat pada bangku sekolah (SMA/SMK/Sederajat). Project ini bertujuan untuk memudahkan siswa dalam menghitung persamaan atau problem-problem yang terdapat pada pelajaran sekolah (cheat egine untuk Sekolah). diff --git a/app/docs/page.ts b/app/docs/page.ts new file mode 100644 index 0000000..c6c0388 --- /dev/null +++ b/app/docs/page.ts @@ -0,0 +1,5 @@ +import { permanentRedirect } from "next/navigation"; + +export default function Page() { + permanentRedirect("/docs/get-started/tentang"); +} diff --git a/app/docs/statistika/entropy/page.mdx b/app/docs/statistika/entropy/page.mdx index d7b5314..ec36636 100644 --- a/app/docs/statistika/entropy/page.mdx +++ b/app/docs/statistika/entropy/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Entropy diff --git a/app/docs/statistika/standar-deviasi/page.mdx b/app/docs/statistika/standar-deviasi/page.mdx index 67b156e..706df0f 100644 --- a/app/docs/statistika/standar-deviasi/page.mdx +++ b/app/docs/statistika/standar-deviasi/page.mdx @@ -1,4 +1,4 @@ -import Codeblock from "@/components/Codeblock"; +import Codeblock from "@/components/codeblock"; # Standar Deviasi diff --git a/app/globals.css b/app/globals.css index 8f6f667..0c99774 100644 --- a/app/globals.css +++ b/app/globals.css @@ -20,63 +20,61 @@ @apply text-zinc-500 dark:text-zinc-400; } - pre[data-theme*=" "] { - @apply bg-[var(--shiki-light-bg)]; - } - - code[data-theme*=" "], - code[data-theme*=" "] span { - @apply bg-[var(--shiki-light-bg)] text-[var(--shiki-light)]; + [data-line-numbers] { + @apply [counter-reset:line]; } - html.dark code[data-theme*=" "], - html.dark code[data-theme*=" "] span { - color: var(--shiki-dark); - background-color: var(--shiki-dark-bg); + [data-line-numbers] > [data-line]::before { + @apply mr-4 inline-block w-4 text-right text-[zinc] [content:counter(line)] [counter-increment:line]; } - html.dark pre[data-theme*=" "] { - background-color: var(--shiki-dark-bg); + code[data-line-numbers-max-digits="2"] { + @apply [&>[data-line]]:before:w-8; } - [data-line-numbers] { - counter-reset: line; + code[data-line-numbers-max-digits="3"] > [data-line]::before { + @apply [&>[data-line]]:before:w-12; } - [data-line-numbers] > [data-line]::before { - counter-increment: line; - content: counter(line); - display: inline-block; - width: 1rem; - margin-right: 1rem; - text-align: right; - color: zinc; + #landing-svg path { + @apply [stroke-dasharray:var(--stroke-dasharray)] [stroke-dashoffset:var(--stroke-dashoffset)]; } +} - code[data-line-numbers-max-digits="2"] > [data-line]::before { - width: 2rem; +@define-mixin syntax-highight $theme { + html.$(theme) pre[data-theme*=" "] { + background-color: var(--shiki-$(theme)-bg); } - code[data-line-numbers-max-digits="3"] > [data-line]::before { - width: 3rem; + html.$(theme) code[data-theme*=" "], + html.$(theme) code[data-theme*=" "] span { + color: var(--shiki-$(theme)); + background-color: var(--shiki-$(theme)-bg); } } -@layer components { - #landing-svg path { - stroke-dashoffset: 3000; - stroke-dasharray: 3000; - } - - @keyframes landing-svg-anim { +@define-mixin svg-anim $theme { + @keyframes landing-svg-anim-$(theme) { 0%, 100% { - opacity: 0; + @apply fill-transparent [stroke-dashoffset:var(--stroke-dashoffset)]; } 50% { - stroke-dashoffset: 0; - opacity: 100; + @apply [stroke-dashoffset:0]; + + @mixin-content; } } } + +@mixin svg-anim light { + fill: theme("colors.zinc.800"); +} + +@mixin svg-anim dark { + fill: theme("colors.white"); +} + +@mixin syntax-highight light; +@mixin syntax-highight dark; diff --git a/app/layout.tsx b/app/layout.tsx index 4c3447f..02cc9d8 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,27 +1,59 @@ import type { Metadata } from "next"; import { Montserrat } from "next/font/google"; -import "./globals.css"; import NextTopLoader from "nextjs-toploader"; -import Provider from "@/components/Provider"; -import Navbar from "@/components/Navbar"; +import { ReactNode } from "react"; + +import Navbar from "@/components/navbar"; +import ThemeProvider from "@/components/theme-provider"; + +import "./globals.css"; const montserrat = Montserrat({ subsets: ["latin"] }); export const metadata: Metadata = { - title: "OpenSeries", + metadataBase: new URL(process.env.NEXT_PUBLIC_URL || "http://localhost:3000"), + title: "OpenSeries - Cheat Engine Hitung-Hitungan by Bellshade", description: - "Project Untuk Menghitung Segala Jenis Persamaan atau Rumus-Rumus yang terdapat pada bangku sekolah (SMA/SMK/Sederajat). Project ini bertujuan untuk memudahkan siswa dalam menghitung persamaan atau problem-problem yang terdapat pada pelajaran sekolah (cheat egine untuk Sekolah)." + "Project Untuk Menghitung Segala Jenis Persamaan atau Rumus-Rumus yang terdapat pada bangku sekolah (SMA/SMK/Sederajat). Project ini bertujuan untuk memudahkan siswa dalam menghitung persamaan atau problem-problem yang terdapat pada pelajaran sekolah (cheat egine untuk Sekolah).", + keywords: [ + "OpenSeries", + "Bellshade", + "Bellshade OpenSeries", + "Library matematika", + "Library fisika", + "Library statistika", + "Library python matematika", + "Library python fisika", + "Library python statistika", + "Matematika SMA/SMK", + "Fisika SMA/SMK", + "Statistika SMA/SMK", + "Cheatsheet matematika", + "Cheatsheet fisika", + "Cheatsheet statistika", + "Python playground", + "Cheat engine SMA/SMK", + "Cheat engine matematika", + "Cheat engine fisika", + "Cheat engine statistika", + "OpenSeries python" + ], + applicationName: "OpenSeries", + creator: "Bellshade", + openGraph: { + images: ["/assets/img/banner.png"] + } }; -export default function RootLayout({ children }: { children: React.ReactNode }) { +export default function RootLayout({ children }: { children: ReactNode }) { return ( - + {children} - + ); diff --git a/bun.lockb b/bun.lockb index 4812488..738b420 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/LandingSvg.tsx b/components/LandingSvg.tsx deleted file mode 100644 index 9a72c5a..0000000 --- a/components/LandingSvg.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import { useEffect } from "react"; - -const LandingSvg = (props: React.SVGProps) => { - useEffect(() => { - const paths = document.querySelectorAll("#landing-svg path"); - - function animatePath(path: SVGPathElement) { - const length = String(path.getTotalLength()); - - path.style.strokeDasharray = length; - path.style.strokeDashoffset = length; - - const delay = Math.random() * 50000; - - setTimeout(() => { - path.style.animation = "landing-svg-anim 5s ease infinite"; - path.style.strokeDashoffset = length; - }, delay); - } - - paths.forEach((path) => { - animatePath(path); - }); - }); - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; -export default LandingSvg; diff --git a/components/Navbar.tsx b/components/Navbar.tsx deleted file mode 100644 index 04b2b35..0000000 --- a/components/Navbar.tsx +++ /dev/null @@ -1,71 +0,0 @@ -"use client"; - -import { socialLinks } from "@/constants/socialLinks"; -import Link from "next/link"; -import React, { useState } from "react"; -import ThemeSwitcher from "./ThemeSwitcher"; -import { navLinks } from "@/constants/navLinks"; -import { useNavStyle } from "@/hooks/useNavStyle"; - -type Props = {}; - -const Navbar = (props: Props) => { - const { isLanding } = useNavStyle(); - const [isOpen, setIsOpen] = useState(false); - - const landingStyle = "fixed"; - const docsStyle = "sticky px-8"; - - return ( - - ); -}; - -export default Navbar; diff --git a/components/Provider.tsx b/components/Provider.tsx deleted file mode 100644 index b684da0..0000000 --- a/components/Provider.tsx +++ /dev/null @@ -1,28 +0,0 @@ -"use client"; - -import { ThemeProvider } from "next-themes"; -import { useState, useEffect } from "react"; - -type Props = { - children: React.ReactNode; -}; - -const Provider = ({ children }: Props) => { - const [mounted, setMounted] = useState(false); - - useEffect(() => { - setMounted(true); - }, []); - - if (!mounted) { - return <>{children}; - } - - return ( - - {children} - - ); -}; - -export default Provider; diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx deleted file mode 100644 index 7e9f801..0000000 --- a/components/Sidebar.tsx +++ /dev/null @@ -1,73 +0,0 @@ -"use client"; - -import { documentations } from "@/constants/documentations"; -import { featuredLinks } from "@/constants/featuredLinks"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { useState } from "react"; - -type Props = {}; - -export default function Sidebar({}: Props) { - const pathname = usePathname(); - const [isOpen, setIsOpen] = useState(false); - - return ( - <> - - - - ); -} diff --git a/components/Codeblock.tsx b/components/codeblock/index.tsx similarity index 100% rename from components/Codeblock.tsx rename to components/codeblock/index.tsx index 2f2c7fd..0e8b329 100644 --- a/components/Codeblock.tsx +++ b/components/codeblock/index.tsx @@ -1,13 +1,13 @@ "use client"; -import { useCallback, useState } from "react"; -import { usePython } from "react-py"; import { python } from "@codemirror/lang-python"; -import ReactCodeMirror from "@uiw/react-codemirror"; import { vscodeDark } from "@uiw/codemirror-theme-vscode"; +import ReactCodeMirror from "@uiw/react-codemirror"; import { useTheme } from "next-themes"; -import { tomorrow } from "thememirror"; import Link from "next/link"; +import { useCallback, useState } from "react"; +import { usePython } from "react-py"; +import { tomorrow } from "thememirror"; type Props = { code: string; diff --git a/components/Community.tsx b/components/community/index.tsx similarity index 93% rename from components/Community.tsx rename to components/community/index.tsx index 8c704e0..7d44711 100644 --- a/components/Community.tsx +++ b/components/community/index.tsx @@ -1,11 +1,8 @@ "use client"; import { useTheme } from "next-themes"; -import React from "react"; -type Props = {}; - -const Community = (props: Props) => { +const Community = () => { const { theme } = useTheme(); return ( diff --git a/components/Contribute.tsx b/components/contribute/index.tsx similarity index 92% rename from components/Contribute.tsx rename to components/contribute/index.tsx index 7b4d01e..59b90fb 100644 --- a/components/Contribute.tsx +++ b/components/contribute/index.tsx @@ -1,10 +1,8 @@ -import { contributing } from "@/constants/contributing"; import Link from "next/link"; -import React from "react"; -type Props = {}; +import { contributing } from "@/constants/contributing"; -const Contribute = (props: Props) => { +const Contribute = () => { return (
{contributing.map((repo) => ( diff --git a/components/Contributor.tsx b/components/contributors/contributor.tsx similarity index 87% rename from components/Contributor.tsx rename to components/contributors/contributor.tsx index c802626..d9db67c 100644 --- a/components/Contributor.tsx +++ b/components/contributors/contributor.tsx @@ -1,16 +1,13 @@ import Image from "next/image"; import Link from "next/link"; -import { Octokit } from "octokit"; + +import { octokit } from "@/constants/octokit"; type Props = { username: string; }; const Contributor = async ({ username }: Props) => { - const octokit = new Octokit({ - auth: process.env.GITHUB_TOKEN - }); - const { data } = await octokit.request("GET /users/{username}", { username, headers: { diff --git a/components/Contributors.tsx b/components/contributors/index.tsx similarity index 86% rename from components/Contributors.tsx rename to components/contributors/index.tsx index 0e47fd5..b807a30 100644 --- a/components/Contributors.tsx +++ b/components/contributors/index.tsx @@ -1,11 +1,10 @@ -import { coreTeam } from "@/constants/coreTeam"; -import Contributor from "./Contributor"; -import { Octokit } from "octokit"; import Link from "next/link"; -type Props = {}; +import { coreTeam } from "@/constants/core-team"; -const Contributors = async (props: Props) => { +import Contributor from "./contributor"; + +const Contributors = async () => { return ( <>

OpenSeries Team

diff --git a/components/docs-wrapper/index.tsx b/components/docs-wrapper/index.tsx new file mode 100644 index 0000000..f98faf0 --- /dev/null +++ b/components/docs-wrapper/index.tsx @@ -0,0 +1,25 @@ +"use client"; + +import { ReactNode, useEffect } from "react"; +import { PythonProvider } from "react-py"; + +import { useNavStyleStore } from "@/stores/use-nav-style-store"; + +export default function DocsWrapper({ children }: { children: ReactNode }) { + const { setDocsStyle } = useNavStyleStore(); + const packages = { + micropip: ["OpenSeriesBellshade"] + }; + + useEffect(() => { + setDocsStyle(); + }, [setDocsStyle]); + + return ( + +
+ {children} +
+
+ ); +} diff --git a/components/landing-svg/index.tsx b/components/landing-svg/index.tsx new file mode 100644 index 0000000..bbea01e --- /dev/null +++ b/components/landing-svg/index.tsx @@ -0,0 +1,141 @@ +import { useTheme } from "next-themes"; +import { SVGProps, useEffect } from "react"; + +const LandingSvg = (props: SVGProps) => { + const { theme } = useTheme(); + + useEffect(() => { + const paths = document.querySelectorAll("#landing-svg path"); + + function animatePath(path: SVGPathElement) { + const length = String(path.getTotalLength()); + + path.style.setProperty("--stroke-dasharray", length); + path.style.setProperty("--stroke-dashoffset", length); + + const delay = Math.random() * 50000; + + setTimeout(() => { + path.style.animation = `landing-svg-anim-${theme} 5s ease-in-out infinite`; + path.style.strokeDashoffset = length; + }, delay); + } + + paths.forEach((path) => animatePath(path)); + }, [theme]); + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default LandingSvg; diff --git a/components/navbar/breadcrumbs.tsx b/components/navbar/breadcrumbs.tsx new file mode 100644 index 0000000..64eaf30 --- /dev/null +++ b/components/navbar/breadcrumbs.tsx @@ -0,0 +1,35 @@ +"use client"; + +import { usePathname } from "next/navigation"; +import { Fragment } from "react"; + +const Breadcrumbs = () => { + const paths = usePathname(); + const pathNames = paths.split("/").filter((path) => path); + + return ( +
    + {pathNames.map((link, index) => { + if (index === 0) return null; + + const href = `/${pathNames.slice(0, index + 1).join("/")}`; + const label = link.replace(/-/g, " "); + + return ( + +
  1. + {label} +
  2. + {pathNames.length !== index + 1 && ( + + )} +
    + ); + })} +
+ ); +}; + +export default Breadcrumbs; diff --git a/components/navbar/index.tsx b/components/navbar/index.tsx new file mode 100644 index 0000000..ec78ef9 --- /dev/null +++ b/components/navbar/index.tsx @@ -0,0 +1,17 @@ +import { octokit } from "@/constants/octokit"; + +import NavbarContent from "./navbar-content"; + +const Navbar = async () => { + const { data } = await octokit.request("GET /repos/{owner}/{repo}/releases/latest", { + owner: "bellshade", + repo: "OpenSeries", + headers: { + "X-GitHub-Api-Version": "2022-11-28" + } + }); + + return ; +}; + +export default Navbar; diff --git a/components/navbar/navbar-content.tsx b/components/navbar/navbar-content.tsx new file mode 100644 index 0000000..4964a1e --- /dev/null +++ b/components/navbar/navbar-content.tsx @@ -0,0 +1,113 @@ +"use client"; + +import Link from "next/link"; +import { useState } from "react"; + +import { navLinks } from "@/constants/nav-links"; +import { socialLinks } from "@/constants/social-links"; + +import { useNavStyleStore } from "@/stores/use-nav-style-store"; +import { useSidebarStore } from "@/stores/use-sidebar-store"; + +import ThemeSwitcher from "@/components/theme-switcher"; + +import Breadcrumbs from "./breadcrumbs"; + +type Props = { + version: string; +}; + +const NavbarContent = ({ version }: Props) => { + const { isLanding } = useNavStyleStore(); + const [isOpen, setIsOpen] = useState(false); + + const { toggleSidebar } = useSidebarStore(); + + const landingStyle = "fixed"; + const docsStyle = "sticky px-8"; + + return ( + <> + +
setIsOpen(false)} + >
+ + ); +}; + +export default NavbarContent; diff --git a/components/sidebar/index.tsx b/components/sidebar/index.tsx new file mode 100644 index 0000000..523f8af --- /dev/null +++ b/components/sidebar/index.tsx @@ -0,0 +1,79 @@ +"use client"; + +import Link from "next/link"; +import { usePathname } from "next/navigation"; + +import { featuredLinks } from "@/constants/featured-links"; + +import { useSidebarStore } from "@/stores/use-sidebar-store"; + +import { DocumentGroup } from "@/utils/get-docs"; + +type Props = { + sidebarLinks: DocumentGroup; +}; + +const Sidebar = ({ sidebarLinks }: Props) => { + const pathname = usePathname(); + const { isSidebarOpen, toggleSidebar } = useSidebarStore(); + + return ( + <> + +
toggleSidebar()} + >
+ + ); +}; + +export default Sidebar; diff --git a/components/theme-provider/index.tsx b/components/theme-provider/index.tsx new file mode 100644 index 0000000..f55b442 --- /dev/null +++ b/components/theme-provider/index.tsx @@ -0,0 +1,28 @@ +"use client"; + +import { ThemeProvider as Theme } from "next-themes"; +import { ReactNode, useEffect, useState } from "react"; + +type Props = { + children: ReactNode; +}; + +const ThemeProvider = ({ children }: Props) => { + const [mounted, setMounted] = useState(false); + + useEffect(() => { + setMounted(true); + }, []); + + if (!mounted) { + return <>{children}; + } + + return ( + + {children} + + ); +}; + +export default ThemeProvider; diff --git a/components/ThemeSwitcher.tsx b/components/theme-switcher/index.tsx similarity index 100% rename from components/ThemeSwitcher.tsx rename to components/theme-switcher/index.tsx diff --git a/constants/coreTeam.ts b/constants/core-team.ts similarity index 100% rename from constants/coreTeam.ts rename to constants/core-team.ts diff --git a/constants/documentations.ts b/constants/documentations.ts deleted file mode 100644 index 5b91b3d..0000000 --- a/constants/documentations.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { title } from "process"; - -export const documentations = [ - { - parent: "Get Started", - childs: [ - { - title: "Tentang", - href: "/docs" - }, - { - title: "Instalasi", - href: "/docs/get-started/instalasi" - } - ] - }, - { - parent: "Matematika", - childs: [ - { - title: "Radian ke derajat", - href: "/docs/matematika/radian-ke-derajat" - }, - { - title: "Luas Lingkaran", - href: "/docs/matematika/luas-lingkaran" - }, - { - title: "Keliling Lingkaran", - href: "/docs/matematika/keliling-lingkaran" - }, - { - title: "Diameter Lingkaran", - href: "/docs/matematika/diameter-lingkaran" - }, - { - title: "Persamaan Kuadrat", - href: "/docs/matematika/persamaan-kuadrat" - }, - { - title: "Integral", - href: "/docs/matematika/integral" - }, - { - title: "Turunan", - href: "/docs/matematika/turunan" - }, - { - title: "Faktorial", - href: "/docs/matematika/faktorial" - }, - { - title: "Faktor Persekutuan Terbesar", - href: "/docs/matematika/fpb" - }, - { - title: "Sigmoid", - href: "/docs/matematika/sigmoid" - }, - { - title: "Faktor Prima", - href: "/docs/matematika/faktor-prima" - }, - { - title: "Distribusi binomial", - href: "/docs/matematika/distribusi-binomial" - }, - { - title: "Peluang Kejadian", - href: "/docs/matematika/peluang-kejadian" - } - ] - }, - { - parent: "Fisika", - childs: [ - { - title: "Kecepatan", - href: "/docs/fisika/kecepatan" - }, - { - title: "Energi Kinetik", - href: "/docs/fisika/energi-kinetik" - }, - { - title: "Massa Jenis", - href: "/docs/fisika/massa-jenis" - }, - { - title: "Energi Potensial", - href: "/docs/fisika/energi-potensial" - }, - { - title: "Hukum Ohm", - href: "/docs/fisika/hukum-ohm" - }, - { - title: "Efek Doppler", - href: "/docs/fisika/efek-doppler" - }, - { - title: "Tekanan Barometrik", - href: "/docs/fisika/tekanan-barometrik" - }, - { - title: "Percepatan", - href: "/docs/fisika/percepatan" - }, - { - title: "Gaya Sentripetal", - href: "/docs/fisika/gaya-sentripetal" - } - ] - }, - { - parent: "Statistika", - childs: [ - { - title: "Entropy", - href: "/docs/statistika/entropy" - }, - { - title: "Standar Deviasi", - href: "/docs/statistika/standar-deviasi" - } - ] - }, - { - parent: "Bilangan Spesial", - childs: [ - { - title: "Bilangan Armstrong", - href: "/docs/bilangan/bilangan-armstrong" - }, - { - title: "Bilangan Automorphic", - href: "/docs/bilangan/bilangan-automorphic" - }, - { - title: "Bilangan Pronic", - href: "/docs/bilangan/bilangan-pronic" - }, - { - title: "Bilangan Segitiga", - href: "/docs/bilangan/bilangan-segitiga" - } - ] - } -]; diff --git a/constants/featuredLinks.ts b/constants/featured-links.ts similarity index 77% rename from constants/featuredLinks.ts rename to constants/featured-links.ts index 0c65c73..fbf1206 100644 --- a/constants/featuredLinks.ts +++ b/constants/featured-links.ts @@ -2,7 +2,7 @@ export const featuredLinks = [ { name: "Kontribusi", icon: "icon-[solar--heart-shine-bold]", - href: "/docs/contribute" + href: "/docs/kontribusi" }, { name: "Request Fitur", @@ -13,12 +13,12 @@ export const featuredLinks = [ { name: "Komunitas", icon: "icon-[solar--users-group-two-rounded-bold]", - href: "/docs/community" + href: "/docs/komunitas" }, { - name: "Playseries", + name: "Playground", icon: "icon-[solar--plain-3-bold]", - href: "https://playseries.vercel.app", + href: "https://play.openseries.blue", target: "_blank" } ]; diff --git a/constants/nav-links.ts b/constants/nav-links.ts new file mode 100644 index 0000000..02e27e4 --- /dev/null +++ b/constants/nav-links.ts @@ -0,0 +1,16 @@ +type NavLink = { + name: string; + href: string; + target?: string; +}; + +export const navLinks: NavLink[] = [ + { + name: "Dokumentasi", + href: "/docs" + }, + { + name: "Komunitas", + href: "/docs/komunitas" + } +]; diff --git a/constants/navLinks.ts b/constants/navLinks.ts deleted file mode 100644 index d5cf5ce..0000000 --- a/constants/navLinks.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const navLinks = [ - { - name: "Docs", - href: "/docs" - }, - { - name: "Kontribusi", - href: "/docs/contribute" - }, - { - name: "Komunitas", - href: "/docs/community" - }, - { - name: "Request Fitur", - href: "https://github.com/bellshade/OpenSeries/issues", - target: "_blank" - }, - { - name: "Playseries", - href: "https://playseries.vercel.app", - target: "_blank" - } -]; diff --git a/constants/octokit.ts b/constants/octokit.ts new file mode 100644 index 0000000..3bcb965 --- /dev/null +++ b/constants/octokit.ts @@ -0,0 +1,5 @@ +import { Octokit } from "octokit"; + +export const octokit = new Octokit({ + auth: process.env.GITHUB_TOKEN +}); diff --git a/constants/projectByLinks.ts b/constants/project-by-links.ts similarity index 100% rename from constants/projectByLinks.ts rename to constants/project-by-links.ts diff --git a/constants/sidebar-links.ts b/constants/sidebar-links.ts new file mode 100644 index 0000000..36ce2a8 --- /dev/null +++ b/constants/sidebar-links.ts @@ -0,0 +1,3 @@ +import { getDocs } from "@/utils/get-docs"; + +export const sidebarLinks = getDocs({ "get started": ["tentang"] }); diff --git a/constants/socialLinks.ts b/constants/social-links.ts similarity index 100% rename from constants/socialLinks.ts rename to constants/social-links.ts diff --git a/next-sitemap.config.js b/next-sitemap.config.js new file mode 100644 index 0000000..e315166 --- /dev/null +++ b/next-sitemap.config.js @@ -0,0 +1,5 @@ +/** @type {import('next-sitemap').IConfig} */ +module.exports = { + siteUrl: process.env.NEXT_PUBLIC_URL || "https://www.openseries.blue", + generateRobotsTxt: true +}; diff --git a/next.config.mjs b/next.config.mjs index 87e2a40..852d36e 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,6 +1,6 @@ -import remarkGfm from "remark-gfm"; import createMDX from "@next/mdx"; import rehypePrettyCode from "rehype-pretty-code"; +import remarkGfm from "remark-gfm"; /** @type {import('next').NextConfig} */ const nextConfig = { diff --git a/package.json b/package.json index c95859e..aa0d61f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "build": "next build", "start": "next start", "lint": "next lint", - "format": "prettier --write ." + "format": "prettier --write .", + "mdl": "markdownlint **/*.md --ignore node_modules", + "postbuild": "next-sitemap" }, "dependencies": { "@codemirror/lang-python": "^6.1.4", @@ -17,7 +19,10 @@ "@types/mdx": "^2.0.10", "@uiw/codemirror-theme-vscode": "^4.21.21", "@uiw/react-codemirror": "^4.21.21", + "fast-glob": "^3.3.2", "next": "14.0.4", + "next-mdx-remote": "^4.4.1", + "next-sitemap": "^4.2.3", "next-themes": "^0.2.1", "nextjs-toploader": "^1.6.4", "octokit": "^3.1.2", @@ -34,18 +39,24 @@ "@iconify/json": "^2.2.169", "@iconify/tailwind": "^0.1.4", "@tailwindcss/typography": "^0.5.10", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@types/bun": "^1.0.6", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", + "ajv": "^7", "autoprefixer": "^10.0.1", "eslint": "^8.56.0", "eslint-config-next": "14.0.4", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", + "markdownlint": "^0.33.0", "postcss": "^8", + "postcss-mixins": "^9.0.4", "prettier": "^3.2.2", "prettier-plugin-tailwindcss": "^0.5.11", "tailwindcss": "^3.3.0", - "typescript": "^5" + "typescript": "^5", + "typescript-eslint": "^7.0.1" } } diff --git a/postcss.config.js b/postcss.config.js index fe66dd6..4e1a0ea 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,7 @@ module.exports = { plugins: { tailwindcss: {}, + "postcss-mixins": {}, autoprefixer: {} } }; diff --git a/public/assets/img/banner.png b/public/assets/img/banner.png new file mode 100644 index 0000000..e9dfba4 Binary files /dev/null and b/public/assets/img/banner.png differ diff --git a/hooks/useNavStyle.ts b/stores/use-nav-style-store.ts similarity index 81% rename from hooks/useNavStyle.ts rename to stores/use-nav-style-store.ts index 21ef708..92e9108 100644 --- a/hooks/useNavStyle.ts +++ b/stores/use-nav-style-store.ts @@ -6,7 +6,7 @@ interface NavStyleState { setLandingStyles: () => void; } -export const useNavStyle = create((set) => ({ +export const useNavStyleStore = create((set) => ({ isLanding: true, setDocsStyle: () => set({ isLanding: false }), setLandingStyles: () => set({ isLanding: true }) diff --git a/stores/use-sidebar-store.ts b/stores/use-sidebar-store.ts new file mode 100644 index 0000000..ff0c11b --- /dev/null +++ b/stores/use-sidebar-store.ts @@ -0,0 +1,11 @@ +import { create } from "zustand"; + +interface SidebarState { + isSidebarOpen: boolean; + toggleSidebar: () => void; +} + +export const useSidebarStore = create((set) => ({ + isSidebarOpen: false, + toggleSidebar: () => set((state) => ({ isSidebarOpen: !state.isSidebarOpen })) +})); diff --git a/tailwind.config.ts b/tailwind.config.ts index f26a398..123282f 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,6 +1,6 @@ -import type { Config } from "tailwindcss"; import { addDynamicIconSelectors } from "@iconify/tailwind"; import typography from "@tailwindcss/typography"; +import type { Config } from "tailwindcss"; const config: Config = { darkMode: ["class"], diff --git a/utils/get-docs.ts b/utils/get-docs.ts new file mode 100644 index 0000000..66ad8fd --- /dev/null +++ b/utils/get-docs.ts @@ -0,0 +1,59 @@ +import { globSync } from "fast-glob"; + +export type DocumentGroup = { + [key: string]: { + title: string; + link: string; + }[]; +}; + +type PrioritizedCategories = { + [category: string]: string[]; +}; + +export const getDocs = (prioritizedCategories: PrioritizedCategories) => { + const documentPaths = getDocumentPaths(); + const documentGroup = groupDocumentsByCategory(documentPaths); + const sortedDocuments = prioritizeAndSortDocuments(documentGroup, prioritizedCategories); + return sortedDocuments; +}; + +const getDocumentPaths = () => globSync("app/docs/**/**/*.mdx"); + +const groupDocumentsByCategory = (documentPaths: string[]): DocumentGroup => { + const documentGroup: DocumentGroup = {}; + documentPaths.forEach((path) => { + const match = path.match(/app\/docs\/([\w-]+)\/([\w-]+)\/page\.mdx/); + if (!match || match.length < 3) return; + + const [, category, title] = match; + const formattedCategory = category.replace(/-/g, " "); + const formattedTitle = title.replace(/-/g, " "); + const link = `/docs/${category}/${title}`; + + const categoryKey = formattedCategory.toUpperCase(); + documentGroup[categoryKey] = [...(documentGroup[categoryKey] || []), { title: formattedTitle, link }]; + }); + return documentGroup; +}; + +const prioritizeAndSortDocuments = ( + documentGroup: DocumentGroup, + prioritizedCategories: PrioritizedCategories +): DocumentGroup => { + const sortedDocuments: DocumentGroup = {}; + + Object.entries(prioritizedCategories).forEach(([category, links]) => { + const categoryKey = category.toUpperCase(); + if (documentGroup[categoryKey]) { + sortedDocuments[categoryKey] = documentGroup[categoryKey].sort((a, b) => + links.includes(a.title.toLowerCase()) ? -1 : links.includes(b.title.toLowerCase()) ? 1 : 0 + ); + delete documentGroup[categoryKey]; + } + }); + + Object.assign(sortedDocuments, documentGroup); + + return sortedDocuments; +};