-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
204 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/node_modules | ||
/.pnp | ||
.pnp.js | ||
/.yarn | ||
|
||
# testing | ||
/coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import React from "react" | ||
import React, { useContext } from "react" | ||
import { LangContext, useDictionary } from "../lang/dict_manager" | ||
import styles from "../styles/Home.module.css" | ||
import { TextCountdown } from "./text_countdown" | ||
|
||
const COUNTDOWN_FORMATS = { | ||
immediate: "(Now!)", | ||
forFuture: "(in %@)", | ||
forPast: "(%@ ago)", | ||
} | ||
|
||
export function VideoBox(props) { | ||
const lang = useContext(LangContext) | ||
const dict = useDictionary() | ||
|
||
return <div className={`${styles.videoBox}`}> | ||
<div className={styles.vstack}> | ||
{props.caption? | ||
<p className={`${styles.videoBoxCaption}`}> | ||
{props.caption} {" "} | ||
{(props.showCountdown && props.info.startTime)? | ||
<span className={styles.countdown}><TextCountdown to={props.info.startTime} formatStrings={COUNTDOWN_FORMATS} /></span> | ||
<span className={styles.countdown}><TextCountdown to={props.info.startTime} formatStrings={dict.Countdowns.VideoBox} /></span> | ||
: null | ||
} | ||
</p> | ||
: null | ||
} | ||
<p><a href={props.info.link}>{props.info.title}</a></p> | ||
{props.info.isMembersOnly ? <p>(for Faunatics only!)</p> : null} | ||
{props.info.isMembersOnly ? <p>{lang.VideoBox.MembersOnlySubtext}</p> : null} | ||
</div> | ||
{props.info.thumbnail ? <img src={props.info.thumbnail} alt="thumbnail" width={120} /> : null} | ||
{props.info.thumbnail ? <img src={props.info.thumbnail} alt={lang.VideoBox.ThumbnailAltText} width={120} /> : null} | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useRouter } from "next/router" | ||
import { createContext } from "react" | ||
import LocalizedStrings from "react-localization" | ||
import AllStrings from "./strings" | ||
|
||
const dummyEmptyLocalizedStrings = new LocalizedStrings({"a": "aa"}) | ||
export const LangContext = createContext(dummyEmptyLocalizedStrings) | ||
|
||
export function useLangCode() { | ||
const { locale, defaultLocale } = useRouter() | ||
const resolvedLocale = locale? locale : defaultLocale | ||
return resolvedLocale | ||
} | ||
|
||
export function useDictionary() { | ||
const langCode = useLangCode() | ||
return AllStrings[langCode] | ||
} | ||
|
||
export function useLocalizationForRootComponentsOnly() { | ||
const langCode = useLangCode() | ||
return new LocalizedStrings(AllStrings, {customLanguageInterface: () => langCode}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const AllStrings = {} | ||
|
||
// To add a new language, copypaste starting from this line... | ||
AllStrings["en"] = { | ||
CommonMetadata: { | ||
HeaderSMTitle: "I MISS FAUNA", | ||
FooterText: "Not affiliated with Fauna or hololive - Past stream data provided by Holodex - {0}", | ||
FooterSourceLink: "Source", | ||
FooterStreamerLink: "Ceres Fauna Ch. hololive-EN" | ||
}, | ||
|
||
Main: { | ||
PageTitle: "I MISS FAUNA", | ||
DontMissCaption: "I Don't Miss Fauna", | ||
ImageAlt: "Meme", | ||
RandomVodLink: "Do your reps", | ||
ErrorMessageChannelLink: "You can check Fauna's channel yourself", | ||
ErrorOccurred: "There was a problem checking stream status. {0}!", | ||
Embed: { | ||
TextLive: "Streaming: {0}", | ||
TextStartingSoon: "Streaming: {0}", | ||
TextStreamQueued: "Streaming: {0}", | ||
} | ||
}, | ||
|
||
VideoBox: { | ||
StatusLive: "LIVE", | ||
StatusStartingSoon: "Starting Soon", | ||
StatusStreamQueued: "Next Stream", | ||
NoStreamDummyStatus: "Current Stream", | ||
NoStreamDummyTitle: "NOTHING UUUUUUUuuuuuu", | ||
MembersOnlySubtext: "(for Faunatics only!)", | ||
ThumbnailAltText: "Video Thumbnail" | ||
}, | ||
|
||
Reps: { | ||
PageTitle: "Do your reps!", | ||
SMMetaDescription: "Get a random Fauna VOD to watch!", | ||
VodInfoUploadDate: "Streamed or uploaded on {0}", | ||
PageCaption: "Watch this one!", | ||
RerollButton: "Reroll", | ||
BackToStreamTrackerButton: "Back to stream tracker", | ||
ErrorDescription: "A problem occurred while getting a random video: {0}", | ||
|
||
ErrorCodes: { | ||
NO_VIDEO_FOUND: "No video found." | ||
}, | ||
}, | ||
|
||
Countdowns: { | ||
VideoBox: { | ||
immediate: "(Now!)", | ||
forFuture: "(in %@)", | ||
forPast: "(%@ ago)", | ||
days: "%@d", | ||
hours: "%@h", | ||
minutes: "%@m", | ||
seconds: "%@s", | ||
separator: " ", | ||
}, | ||
PastStream: { | ||
immediate: "", | ||
forFuture: "", | ||
forPast: `%@ without Fauna`, | ||
days: (days) => (days > 1 ? `${days} days` : `${days} day`), | ||
hours: (hours) => (hours > 1 ? `${hours} hours` : `${hours} hour`), | ||
minutes: (minutes) => (minutes > 1 ? `${minutes} minutes` : `${minutes} minute`), | ||
seconds: (seconds) => (seconds > 1 ? `${seconds} seconds` : `${seconds} second`), | ||
separator: ", " | ||
} | ||
}, | ||
FormatDateShort: (date) => date.toLocaleDateString("en-US", {month: "short", day: "numeric", year: "numeric"}) | ||
} | ||
// ...down to this line. | ||
|
||
export default AllStrings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
module.exports = { | ||
reactStrictMode: true, | ||
i18n: { | ||
locales: ["en"], | ||
defaultLocale: "en" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.