Skip to content

Commit

Permalink
Merge pull request #159 from Miruro-no-kuon/preview-main
Browse files Browse the repository at this point in the history
Preview main
  • Loading branch information
trying559 authored Mar 8, 2024
2 parents f4ad9fb + 1e5f34f commit 17e3eb2
Show file tree
Hide file tree
Showing 19 changed files with 959 additions and 497 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
## ⚠️ Heads Up:
### `JS` to `TS` Transition Branch Alert

🔷 Hey, just so you know, this branch is in the middle of a big switcheroo from 📜 **JavaScript** to **TypeScript**. It's a work in progress, so expect some hiccups and weird stuff.

🚧 Thanks for rolling with us while we jazz up this template. Appreciate your patience!

<p align="center">
<a href="https://www.miruro.com" target="_blank">
Expand All @@ -12,7 +7,8 @@
</p>

<h1 align="center">
MIRURO<a href="https://www.miruro.com">.com</a>
MIRURO<a href="https://www.miruro.com">.COM</a> ||
MIRURO<a href="https://www.miruro.tv">.TV</a>
<p align="center">
<img src="https://discordapp.com/api/guilds/1199699127190167643/widget.png?style=shield" alt="Discord Shield"/>
</p>
Expand All @@ -26,9 +22,13 @@
<a href="#"><img src="https://img.shields.io/badge/cloudflare-white.svg?style=for-the-badge&logo=cloudflare&logoColor=orange"/></a>
</p>

### ⚠️ Heads Up:
#### `JS` to `TS` codebase transition alert; It's a work in progress, so expect some hiccups and weird stuff :)


## What is Miruro?

<p><a href="https://www.miruro.com">Miruro</a> is an anime streaming website made possible by the <a href="https://github.com/consumet">Consumet API</a>, built with <a href="https://react.dev/">React⚛️</a> and <a href="https://vitejs.dev/">Vite</a>, featuring a sleek and modern design. It offers Anilist integration to help you keep track of your favorite anime series. Your Website Name is entirely free and does not display any ads, making it a great option for those who want an uninterrupted viewing experience.</p>
<p><a href="https://www.miruro.com">Miruro</a> is a cutting-edge anime streaming platform powered by the <a href="https://github.com/consumet">Consumet API</a>. Crafted using <a href="https://react.dev/">React</a> and <a href="https://vitejs.dev/">Vite</a>, it boasts a stylish and contemporary interface. Our platform, Miruro.com, is completely ad-free, ensuring an immersive viewing journey without interruptions.</p>

## Features 🪴

Expand Down Expand Up @@ -71,7 +71,7 @@

### Before starting installation ⚠️

> Before we proceed with the installation, we strongly recommend using `Bun` for a seamless and efficient setup. While `Node.js` is an alternative, Bun provides a comprehensive solution tailored for our project.
> Before we proceed with the installation, we strongly recommend using `bun` for a seamless and efficient setup. While `Node.js` is an alternative, Bun provides a comprehensive solution tailored for our project.
### 1. Clone this repository using

Expand Down Expand Up @@ -176,7 +176,7 @@ If you have any questions or feedback, please reach out to us at [miruro@proton.

## Support & Contributions 🤲

⭐️ [Star this project](https://github.com/Miruro-no-kuon/Miruro-no-Kuon) ⭐️
⭐️ [Star this project](https://github.com/Miruro-no-kuon/Miruro) ⭐️

Feel free to contribute to this project! Whether you're an experienced developer or have been in the field for a while, your help is valuable.

Expand Down
122 changes: 67 additions & 55 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,71 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Miruro no Kuon - Anime Streaming Site with minimal UI 🍜. Enjoy HD fast streaming of your favorite anime, manga reading, and explore anime-related forums on www.miruro.tv. Discover a world of anime entertainment at Miruro no Kuon!">
<link rel="manifest" href="manifest.json">
<link rel="icon" type="image/webp" href="./src/assets/favicons/favicon-miruro.webp">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Miruro no Kuon - Anime Streaming Site with minimal UI 🍜. Enjoy HD fast streaming of your favorite anime, manga reading, and explore anime-related forums on www.miruro.tv. Discover a world of anime entertainment at Miruro no Kuon!"
/>
<link rel="manifest" href="manifest.json" />
<link
rel="icon"
type="image/webp"
href="./src/assets/favicons/favicon-miruro.webp"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<title>Miruro</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
/>
<style>
/* Custom scrollbar */
::-webkit-scrollbar {
width: 5px; /* Set the width of the scrollbar */
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 5px; /* Set the width of the scrollbar */
}

/* Track */
::-webkit-scrollbar-track {
background: transparent; /* Make scrollbar track transparent */
}
/* Track */
::-webkit-scrollbar-track {
background: transparent; /* Make scrollbar track transparent */
}

/* Handle */
::-webkit-scrollbar-thumb {
background: #888; /* Color of the scrollbar handle */
border-radius: 10px; /* Roundness of the scrollbar handle */
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888; /* Color of the scrollbar handle */
border-radius: 10px; /* Roundness of the scrollbar handle */
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555; /* Color of the scrollbar handle on hover */
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555; /* Color of the scrollbar handle on hover */
}

/* Define your theme styles here */
body[data-theme="dark"] {
background-color: #080808;
color: #fff; /* Adjust text color for dark theme */
}
/* Define your theme styles here */
body[data-theme="dark"] {
background-color: #080808;
color: #fff; /* Adjust text color for dark theme */
}

body[data-theme="light"] {
background-color: #f5f5f5;
color: #000; /* Adjust text color for light theme */
}
body[data-theme="light"] {
background-color: #f5f5f5;
color: #000; /* Adjust text color for light theme */
}
</style>
</head>
<body data-simplebar>
</head>
<body data-simplebar>
<div id="root"></div>
<script>
const themePreference = localStorage.getItem("themePreference");
const themePreference = localStorage.getItem("themePreference");

if (themePreference === "dark") {
document.body.style.backgroundColor = "#080808";
} else if (themePreference === "light") {
document.body.style.backgroundColor = "#f5f5f5";
} else if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
document.body.style.backgroundColor = "#080808"; // Set to dark if user prefers dark theme
} else {
document.body.style.backgroundColor = "#f5f5f5"; // Set to light if none of the above conditions match
}
document.addEventListener("DOMContentLoaded", function () {
document.body.style.backgroundColor = "";
});
if (themePreference === "dark") {
document.body.style.backgroundColor = "#080808";
} else if (themePreference === "light") {
document.body.style.backgroundColor = "#f5f5f5";
} else if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
document.body.style.backgroundColor = "#080808"; // Set to dark if user prefers dark theme
} else {
document.body.style.backgroundColor = "#f5f5f5"; // Set to light if none of the above conditions match
}

document.addEventListener("DOMContentLoaded", function () {
document.body.style.backgroundColor = "";
});
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</body>
</html>

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-infinite-scroll-component": "^6.1.0",
"react-lazy-load-image-component": "^1.6.0",
"react-player": "^2.14.1",
"react-router-dom": "^6.22.0",
Expand Down
26 changes: 21 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect } from "react";
import { useEffect, useRef } from "react";
import {
BrowserRouter as Router,
Routes,
Expand All @@ -16,9 +16,23 @@ import PolicyTerms from "./pages/PolicyTerms";

function ScrollToTop() {
const { pathname } = useLocation();
const prevPathnameRef = useRef(pathname);

useEffect(() => {
window.scrollTo(0, 0);
const ignoreRoutePattern = /^\/watch\/[^/]+\/[^/]+\/[^/]+$/;
// Only scroll to if pathname has changed and does not match the ignore pattern
if (
prevPathnameRef.current !== pathname &&
!ignoreRoutePattern.test(pathname)
) {
window.scrollTo({
top: 0,
behavior: "smooth",
});
}

// Update the previous pathname reference for the next render
prevPathnameRef.current = pathname;
}, [pathname]);

return null;
Expand Down Expand Up @@ -48,10 +62,12 @@ function App() {
<Route path="/home" element={<Home />} />
<Route path="/search" element={<SearchResults />} />
<Route path="/watch/:animeId" element={<Watch />} />
<Route path="/watch/:animeId/:animeTitle/:episodeNumber" element={<Watch />} />
<Route
path="/watch/:animeId/:animeTitle/:episodeNumber"
element={<Watch />}
/>
<Route path="/about" element={<About />} />
<Route path="/policy" element={<PolicyTerms />} />
<Route path="/terms" element={<PolicyTerms />} />
<Route path="/policyterms" element={<PolicyTerms />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
<Footer />
Expand Down
40 changes: 20 additions & 20 deletions src/components/Cards/CardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef, useMemo } from "react";
import styled /* keyframes */ from "styled-components";
// Assuming CardItem and CardSkeleton are correctly typed elsewhere
import CardItem from "./CardItem";
import CardSkeleton from "../Skeletons/CardSkeleton";
// import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
// import { faArrowCircleDown } from "@fortawesome/free-solid-svg-icons";

Expand Down Expand Up @@ -105,10 +104,15 @@ const CardGrid: React.FC<CardGridProps> = ({

useEffect(() => {
const handleScroll = () => {
if (
window.innerHeight + document.documentElement.scrollTop ===
document.documentElement.offsetHeight
) {
const windowHeight = window.innerHeight;
const documentHeight = document.documentElement.offsetHeight;
const scrollTop =
document.documentElement.scrollTop || document.body.scrollTop;

// Adjust this threshold as needed
const threshold = 1000;

if (windowHeight + scrollTop >= documentHeight - threshold) {
handleLoadMore();
}
};
Expand All @@ -121,20 +125,16 @@ const CardGrid: React.FC<CardGridProps> = ({

return (
<StyledCardGrid>
{loading
? Array.from({ length: animeData.length }).map((_, index) => (
<CardSkeleton key={index} />
))
: animeData.map((anime) => (
<CardItem
key={anime.id}
anime={anime}
onHover={() => handleCardHover(anime.id)}
onLeave={() => handleCardLeave(anime.id)}
isHoveredInstant={hoveredCardInstant === anime.id}
isHoveredDelayed={hoveredCardDelayed === anime.id}
/>
))}
{animeData.map((anime) => (
<CardItem
key={anime.id}
anime={anime}
onHover={() => handleCardHover(anime.id)}
onLeave={() => handleCardLeave(anime.id)}
isHoveredInstant={hoveredCardInstant === anime.id}
isHoveredDelayed={hoveredCardDelayed === anime.id}
/>
))}
</StyledCardGrid>
);
};
Expand All @@ -147,7 +147,7 @@ export const StyledCardGrid = styled.div`
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
grid-template-rows: auto;
gap: 1.75rem;
transition: grid-template-columns 0.5s ease-in-out;
transition: grid-template-columns 0.2s ease-in-out;
@media (max-width: 1200px) {
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
Expand Down
Loading

0 comments on commit 17e3eb2

Please sign in to comment.