([
33 | 'relationship',
34 | 'complicated',
35 | 'single',
36 | ])[0]!,
37 | };
38 | };
39 |
40 | export function makeData(...lens: number[]) {
41 | const makeDataLevel = (depth = 0): Person[] => {
42 | const len = lens[depth]!;
43 | return range(len).map((d): Person => {
44 | return {
45 | ...newPerson(d),
46 | };
47 | });
48 | };
49 |
50 | return makeDataLevel();
51 | }
52 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsAdvanced.tsx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent, Divider, Link, Typography } from '@mui/material';
2 | import parse from 'html-react-parser';
3 | import { memo, useEffect } from 'react';
4 | import { useNewsInfo } from 'renderer/context/NewsInfoContext';
5 | import { useNewsServiceType } from 'renderer/context/NewsServiceTypeContext';
6 | import 'renderer/styles/NewsAdvanced.scss';
7 | import LoadingNews from '../etc/LoadingNews';
8 |
9 | const NewsAdvanced = memo(({ props }: any) => {
10 | const myNewsInfo: any = useNewsInfo();
11 | const myService: any = useNewsServiceType();
12 |
13 | useEffect(() => {
14 | const removeEventListener = window.electron.ipcRenderer.on(
15 | 'newsAdvanced',
16 | (arg) => {
17 | // eslint-disable-next-line no-console
18 | if (myNewsInfo.NewsInfo !== arg) {
19 | console.log(arg);
20 | myNewsInfo.setNewsInfo(arg);
21 | }
22 | },
23 | );
24 | return () => {
25 | removeEventListener();
26 | };
27 | }, [myNewsInfo, myService.news]);
28 |
29 | return myNewsInfo.NewsInfo.title !== '' ? (
30 |
40 |
41 |
47 |
48 | {parse(myNewsInfo.NewsInfo.title)}
49 |
50 |
51 |
52 |
53 |
54 |
55 | {parse(myNewsInfo.NewsInfo.date)}
56 |
57 |
58 | {parse(myNewsInfo.NewsInfo.main)}
59 |
60 |
61 |
62 | ) : (
63 |
64 | );
65 | });
66 |
67 | export default NewsAdvanced;
68 |
69 | // add target = _blank to a tags and add allowfullscreen to iframe. Also look at special html characters when converting to string.
70 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsBar.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | Drawer,
3 | List,
4 | ListItem,
5 | ListItemButton,
6 | ListItemIcon,
7 | } from '@mui/material';
8 | import { useNewsAdv } from 'renderer/context/NewsAdvContext';
9 | import ArrowBackIcon from '@mui/icons-material/ArrowBack';
10 | import { useNewsInfo } from 'renderer/context/NewsInfoContext';
11 | import { useNavigate } from 'react-router-dom';
12 |
13 | export default function NewsBack({ props }: any) {
14 | const newsAdv: any = useNewsAdv();
15 | const myNewsInfo: any = useNewsInfo();
16 | const navigate = useNavigate();
17 |
18 | return (
19 |
24 |
25 | {['Back'].map((text, index) => (
26 |
27 | {
33 | newsAdv.toggleNews();
34 | myNewsInfo.setNewsInfo({
35 | title: '',
36 | titleURL: '',
37 | author: '',
38 | authorUrl: '',
39 | main: '',
40 | date: '',
41 | });
42 | navigate('/');
43 | }}
44 | >
45 |
50 |
51 |
52 |
53 |
54 | ))}
55 |
56 |
57 | );
58 | }
59 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsButtons.tsx:
--------------------------------------------------------------------------------
1 | import Box from '@mui/material/Box';
2 |
3 | export default function NewsButtons({ props }: any) {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsButtonsAdvanced.tsx:
--------------------------------------------------------------------------------
1 | import Box from '@mui/material/Box';
2 |
3 | import NewsBack from './NewsBar';
4 |
5 | export default function NewsButtonsAdvanced({ props }: any) {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsFullscreen.tsx:
--------------------------------------------------------------------------------
1 | import FullscreenIcon from '@mui/icons-material/Fullscreen';
2 | import { IconButton } from '@mui/material';
3 |
4 | export default function NewsFullscreen({ props }: any) {
5 | const handleClick = () => {
6 | console.log('fullscreen');
7 | };
8 |
9 | return (
10 |
11 |
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/src/renderer/components/app/news/NewsRefresh.tsx:
--------------------------------------------------------------------------------
1 | import RefreshIcon from '@mui/icons-material/Refresh';
2 | import { ToggleButton, Typography } from '@mui/material';
3 | import { useState } from 'react';
4 | import { useNews } from 'renderer/context/NewsContext';
5 | import { useNewsServiceType } from 'renderer/context/NewsServiceTypeContext';
6 | import { useNewsQuery } from 'renderer/functions/NewsFunctions';
7 | import isOnline from 'is-online';
8 | import HtmlTooltip from '../etc/CustomTooltip1';
9 |
10 | export default function NewsRefresh({ props }: any) {
11 | const newsCards: any = useNews();
12 | const newsServiceType: any = useNewsServiceType();
13 |
14 | const { data, refetch } = useNewsQuery(newsCards);
15 | const [isDisabled, setIsDisabled] = useState(false);
16 |
17 | async function fetchAPI() {
18 | setIsDisabled(true);
19 | let checkOnline = false;
20 | checkOnline = await isOnline();
21 | console.log(checkOnline);
22 | if (checkOnline) {
23 | await refetch();
24 | }
25 | setIsDisabled(false);
26 | }
27 |
28 | const handleClick = () => {
29 | if (newsServiceType.news === true) {
30 | fetchAPI();
31 | } else {
32 | window.electron.ipcRenderer.sendMessage('newsList', ['ping']);
33 | }
34 | console.log(newsServiceType.news);
35 | };
36 |
37 | return (
38 |
41 |
42 | Refresh News
43 |
44 | >
45 | }
46 | placement="top"
47 | >
48 |
54 |
55 |
56 |
57 | );
58 | }
59 |
--------------------------------------------------------------------------------
/src/renderer/components/app/search/SearchTabLi.tsx:
--------------------------------------------------------------------------------
1 | import { useCategory } from 'renderer/context/CategoryContext';
2 | import { useFilter } from 'renderer/context/FilterContext';
3 | import { useSidebarButton } from 'renderer/context/SidebarContext';
4 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
5 | import { useAniListUsername } from 'renderer/context/services/AniListUsernameContext';
6 | import { useSort } from 'renderer/context/SortContext';
7 | import { useTitle } from 'renderer/context/TitleContext';
8 | import { useSearchQuery } from 'renderer/functions/SearchFunctions';
9 | import { useSearchTerm } from 'renderer/context/SearchTermContext';
10 | import { useAdult } from 'renderer/context/AdultContext';
11 | import LoadingMessage from '../etc/LoadingMessage';
12 | import ErrorCredentials from '../etc/ErrorCredentials';
13 | import ErrorAPI from '../etc/ErrorAPI';
14 | import SearchTabList from './SearchTabList';
15 |
16 | const SearchTabLi = ({ props }: any) => {
17 | const myTitle: any = useTitle();
18 | const myFilter: any = useFilter();
19 | const myToken: any = useAniListToken();
20 | const myUsername: any = useAniListUsername();
21 | const searchTerm: any = useSearchTerm();
22 | const mySidebar: any = useSidebarButton();
23 | const adult: any = useAdult();
24 | const myCategory: any = useCategory();
25 | const mySort: any = useSort();
26 |
27 | const { isLoading, isError, error, data, refetch, dataUpdatedAt }: any =
28 | useSearchQuery(searchTerm.SearchTerm, myToken.AniListToken, adult.adult);
29 |
30 | if (isLoading) {
31 | return ;
32 | }
33 |
34 | if (isError && error.response !== undefined) {
35 | if (error.response.status === 400) return ;
36 | }
37 |
38 | if (isError && error.response !== undefined) {
39 | if (error.response.status !== 400) return ;
40 | }
41 |
42 | if (isError && error.response === undefined) {
43 | return ;
44 | }
45 |
46 | return ;
47 | };
48 |
49 | export default SearchTabLi;
50 |
--------------------------------------------------------------------------------
/src/renderer/components/app/search/tables/SearchTitleTableBox.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Typography } from '@mui/material';
2 | import React from 'react';
3 | import { getTitle } from 'renderer/functions/view/TitlePreferenceFunctions';
4 | import { useTitle } from 'renderer/context/TitleContext';
5 | import { useSearchTerm } from 'renderer/context/SearchTermContext';
6 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
7 | import { useAdult } from 'renderer/context/AdultContext';
8 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
9 | import { useSearchQuery } from 'renderer/functions/SearchFunctions';
10 | import { OnListIcon } from '../../etc/SvgIcons';
11 |
12 | const SearchTitleTableBox = ({ title, row }: any) => {
13 | const titlePreference: any = useTitle();
14 | const searchTerm: any = useSearchTerm();
15 | const myToken: any = useAniListToken();
16 | const adult: any = useAdult();
17 | const myAdvancedMedia: any = useAdvancedMedia();
18 |
19 | // this fixes the setQuery not reupdating
20 | const { data, refetch, dataUpdatedAt } = useSearchQuery(
21 | searchTerm.SearchTerm,
22 | myToken.AniListToken,
23 | adult.adult,
24 | );
25 |
26 | return (
27 |
28 | {row.mediaListEntry !== null ? : null}
29 |
30 | {getTitle(title, row)}
31 |
32 |
33 | );
34 | };
35 |
36 | export default SearchTitleTableBox;
37 |
--------------------------------------------------------------------------------
/src/renderer/components/app/seasons/SeasonMenu.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const SeasonMenu = () => {
4 | return SeasonMenu
;
5 | };
6 |
7 | export default SeasonMenu;
8 |
--------------------------------------------------------------------------------
/src/renderer/components/app/seasons/SeasonTabLi.tsx:
--------------------------------------------------------------------------------
1 | import { useCategory } from 'renderer/context/CategoryContext';
2 | import { useFilter } from 'renderer/context/FilterContext';
3 | import { useSidebarButton } from 'renderer/context/SidebarContext';
4 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
5 | import { useAniListUsername } from 'renderer/context/services/AniListUsernameContext';
6 | import { useSort } from 'renderer/context/SortContext';
7 | import { useTitle } from 'renderer/context/TitleContext';
8 | import { useSearchTerm } from 'renderer/context/SearchTermContext';
9 | import { useAdult } from 'renderer/context/AdultContext';
10 | import { useSeasonInput } from 'renderer/context/SeasonInputContext';
11 | import { useSeasonsQuery } from 'renderer/functions/SeasonsFunctions';
12 | import LoadingMessage from '../etc/LoadingMessage';
13 | import ErrorCredentials from '../etc/ErrorCredentials';
14 | import ErrorAPI from '../etc/ErrorAPI';
15 | import SeasonTabList from './SeasonTabList';
16 |
17 | const SeasonTabLi = ({ props }: any) => {
18 | const myTitle: any = useTitle();
19 | const myFilter: any = useFilter();
20 | const myToken: any = useAniListToken();
21 | const myUsername: any = useAniListUsername();
22 | const searchTerm: any = useSearchTerm();
23 | const mySidebar: any = useSidebarButton();
24 | const adult: any = useAdult();
25 | const myCategory: any = useCategory();
26 | const mySort: any = useSort();
27 | const seasonInput: any = useSeasonInput();
28 | const myUserName: any = useAniListUsername();
29 |
30 | const { isLoading, isError, error, data, refetch, dataUpdatedAt }: any =
31 | useSeasonsQuery(
32 | seasonInput.seasonInput,
33 | myToken.AniListToken,
34 | myUserName.AniListUsername,
35 | adult.adult,
36 | );
37 |
38 | if (isLoading) {
39 | return ;
40 | }
41 |
42 | if (isError && error.response !== undefined) {
43 | if (error.response.status === 400) return ;
44 | }
45 |
46 | if (isError && error.response !== undefined) {
47 | if (error.response.status !== 400) return ;
48 | }
49 |
50 | if (isError && error.response === undefined) {
51 | return ;
52 | }
53 |
54 | return ;
55 | };
56 |
57 | export default SeasonTabLi;
58 |
--------------------------------------------------------------------------------
/src/renderer/components/app/seasons/tables/SeasonTitleTableBox.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Typography } from '@mui/material';
2 | import React from 'react';
3 | import { getTitle } from 'renderer/functions/view/TitlePreferenceFunctions';
4 | import { useTitle } from 'renderer/context/TitleContext';
5 | import { useSearchTerm } from 'renderer/context/SearchTermContext';
6 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
7 | import { useAdult } from 'renderer/context/AdultContext';
8 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
9 | import { useSeasonsQuery } from 'renderer/functions/SeasonsFunctions';
10 | import { useSeasonInput } from 'renderer/context/SeasonInputContext';
11 | import { useAniListUsername } from 'renderer/context/services/AniListUsernameContext';
12 | import { OnListIcon } from '../../etc/SvgIcons';
13 |
14 | const SeasonTitleTableBox = ({ title, row }: any) => {
15 | const titlePreference: any = useTitle();
16 | const searchTerm: any = useSearchTerm();
17 | const myToken: any = useAniListToken();
18 | const adult: any = useAdult();
19 | const myAdvancedMedia: any = useAdvancedMedia();
20 | const seasonInput: any = useSeasonInput();
21 | const myUserName: any = useAniListUsername();
22 |
23 | // this fixes the setQuery not reupdating
24 | const { data, refetch, dataUpdatedAt } = useSeasonsQuery(
25 | seasonInput.seasonInput,
26 | myToken.AniListToken,
27 | myUserName.AniListUsername,
28 | adult.adult,
29 | );
30 |
31 | return (
32 |
33 | {row.mediaListEntry !== null ? : null}
34 |
35 | {getTitle(title, row)}
36 |
37 |
38 | );
39 | };
40 |
41 | export default SeasonTitleTableBox;
42 |
--------------------------------------------------------------------------------
/src/renderer/components/app/sidebar/FeatureButtonGroupNews.tsx:
--------------------------------------------------------------------------------
1 | import SettingsIcon from '@mui/icons-material/Settings';
2 | import { ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
3 | import NewsRefresh from '../news/NewsRefresh';
4 | import HtmlTooltip from '../etc/CustomTooltip1';
5 |
6 | export default function FeatureButtonGroupNews() {
7 | /*
8 | useEffect(() => {
9 | if (myUsername.AniListUsername !== '' && myToken.AniListToken !== '') {
10 | fetchAPI();
11 | }
12 | // eslint-disable-next-line react-hooks/exhaustive-deps
13 | }, [myUsername.AniListUsername, myToken.AniListToken]);
14 | */
15 | return (
16 |
21 |
22 |
25 |
26 | Settings
27 |
28 | >
29 | }
30 | placement="top"
31 | >
32 | {
36 | window.electron.ipcRenderer.sendMessage('settings', ['ping']);
37 | }}
38 | >
39 |
40 |
41 |
42 |
43 | );
44 | }
45 |
--------------------------------------------------------------------------------
/src/renderer/components/app/test/MediaProgress.tsx:
--------------------------------------------------------------------------------
1 | import { IconButtonProps } from '@mui/material/IconButton';
2 |
3 | interface MediaProps {
4 | titleRomaji: string;
5 | image: string;
6 | key: number;
7 | }
8 |
9 | interface ExpandMoreProps extends IconButtonProps {
10 | expand: boolean;
11 | }
12 |
13 | export default function MediaCardCompact({ props }: any) {
14 | return <>dog>;
15 | }
16 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/AdvancedMain.tsx:
--------------------------------------------------------------------------------
1 | import { useColorScheme as useJoyColorScheme } from '@mui/joy/styles';
2 | import { Paper } from '@mui/material';
3 | import { useColorScheme as useMaterialColorScheme } from '@mui/material/styles';
4 | import { useEffect } from 'react';
5 | import { useTheme } from 'renderer/context/ThemeContext';
6 | import AdvancedDescription from './description/AdvancedDescription';
7 | import EntryInputOnList from './entryInput/onList/EntryInputOnList';
8 | import AdvancedExtra from './extra/AdvancedExtra';
9 | import AdvancedImage from './image/AdvancedImage';
10 | import AdvancedInformation from './information/AdvancedInformation';
11 | import AdvancedTitle from './title/AdvancedTitle';
12 |
13 | export default function AdvancedMain({ props }: any) {
14 | const myTheme: any = useTheme();
15 | const { setMode: setJoyMode } = useJoyColorScheme();
16 | const { mode, setMode: setMaterialMode } = useMaterialColorScheme();
17 |
18 | useEffect(() => {
19 | if (myTheme.theme === true) {
20 | setJoyMode('dark');
21 | setMaterialMode('dark');
22 | } else {
23 | setJoyMode('light');
24 | setMaterialMode('light');
25 | }
26 | }, [myTheme, setJoyMode, setMaterialMode]);
27 |
28 | return (
29 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | );
50 | }
51 |
52 | // title is a 2 liner
53 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/AdvancedMainNOL.tsx:
--------------------------------------------------------------------------------
1 | import { useColorScheme as useJoyColorScheme } from '@mui/joy/styles';
2 | import { Paper } from '@mui/material';
3 | import Box from '@mui/material/Box';
4 | import { useColorScheme as useMaterialColorScheme } from '@mui/material/styles';
5 | import { useEffect } from 'react';
6 | import { useTheme } from 'renderer/context/ThemeContext';
7 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
8 | import AdvancedDescription from './description/AdvancedDescription';
9 | import EntryInputNotOnList from './entryInput/notOnList/EntryInputNotOnList';
10 | import AdvancedExtra from './extra/AdvancedExtra';
11 | import AdvancedImage from './image/AdvancedImage';
12 | import AdvancedInformation from './information/AdvancedInformation';
13 | import AdvancedTitle from './title/AdvancedTitle';
14 |
15 | export default function AdvancedMainNOL({ props }: any) {
16 | const myAdvancedMedia: any = useAdvancedMedia();
17 | const myTheme: any = useTheme();
18 | const { setMode: setJoyMode } = useJoyColorScheme();
19 | const { mode, setMode: setMaterialMode } = useMaterialColorScheme();
20 |
21 | useEffect(() => {
22 | if (myTheme.theme === true) {
23 | setJoyMode('dark');
24 | setMaterialMode('dark');
25 | } else {
26 | setJoyMode('light');
27 | setMaterialMode('light');
28 | }
29 | }, [myTheme, setJoyMode, setMaterialMode]);
30 |
31 | return (
32 | <>
33 | {myAdvancedMedia.advancedMedia.id !== -1 ? (
34 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | ) : (
55 |
56 | )}
57 | >
58 | );
59 | }
60 |
61 | // title is a 2 liner
62 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/description/AdvancedDescription.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Card, CardContent, Typography } from '@mui/material';
2 | import Parser from 'html-react-parser';
3 | import { useTitle } from 'renderer/context/TitleContext';
4 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
5 |
6 | const AdvancedDescription = () => {
7 | const myAdvancedMedia: any = useAdvancedMedia();
8 | const titlePreference: any = useTitle();
9 |
10 | return (
11 |
21 |
22 |
23 |
24 | {myAdvancedMedia.advancedMedia.description !== null
25 | ? Parser(myAdvancedMedia.advancedMedia.description)
26 | : ''}
27 |
28 |
29 |
30 |
31 | );
32 | };
33 |
34 | export default AdvancedDescription;
35 |
36 | /*
37 |
38 | {`Synonyms: ${getOtherTitles(
39 | titlePreference.title,
40 | myAdvancedMedia.advancedMedia
41 | ).map((e: any, index: number) => {
42 | if (
43 | index + 1 !==
44 | getOtherTitles(
45 | titlePreference.title,
46 | myAdvancedMedia.advancedMedia
47 | ).length &&
48 | myAdvancedMedia.advancedMedia.synonyms.length !== 0
49 | ) {
50 | return `${e}, `;
51 | }
52 | return `${e}`;
53 | })}`}
54 | {myAdvancedMedia.advancedMedia.synonyms.map((e: any, index: number) => {
55 | if (index + 1 !== myAdvancedMedia.advancedMedia.synonyms.length) {
56 | return `${e}, `;
57 | }
58 | return `${e}`;
59 | })}
60 |
61 | */
62 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/notOnList/EntryInputNotOnList.tsx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from '@mui/material';
2 | import AddToList from './AddToList';
3 |
4 | export default function EntryInputNotOnList() {
5 | return (
6 |
15 |
24 |
25 |
26 |
27 | );
28 | }
29 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/EntryInputOnList.tsx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from '@mui/material';
2 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 | import MyDatePickerCompletedAt from './MyDatePickerCompletedAt';
5 | import MyDatePickerStartedAt from './MyDatePickerStartedAt';
6 | import NotesInput from './NotesInput';
7 | import PrivateCheckBox from './PrivateCheckBox';
8 | import ProgressInput from './ProgressInput';
9 | import ProgressVolumesInput from './ProgressVolumesInput';
10 | import RepeatInput from './RepeatInput';
11 | import ScoreInput from './ScoreInput';
12 | import StatusSelect from './StatusSelect';
13 | import UpdateButton from './UpdateButton';
14 |
15 | export default function EntryInputOnList() {
16 | const myAdvancedMedia: any = useAdvancedMedia();
17 | const myAdvancedInput: any = useAdvancedInput();
18 |
19 | return (
20 |
29 |
40 |
41 | {myAdvancedMedia.advancedMedia.type === 'MANGA' ? (
42 |
43 | ) : null}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | );
55 | }
56 |
57 | //
58 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/JoyDatePicker.tsx:
--------------------------------------------------------------------------------
1 | import Input from '@mui/joy/Input';
2 | import Stack from '@mui/joy/Stack';
3 |
4 | export default function JoyDatePicker() {
5 | return (
6 |
7 |
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/MyDatePicker.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from '@mui/material';
2 | import { DesktopDatePicker, LocalizationProvider } from '@mui/x-date-pickers';
3 | import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
4 | import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
5 | import dayjs from 'dayjs';
6 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
7 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
8 |
9 | export default function MyDatePicker({ props }: any) {
10 | const myMediaAdvanced: any = useAdvancedMedia();
11 | const myAdvancedInput: any = useAdvancedInput();
12 |
13 | const onChange = (e: any) => {
14 | console.log(myAdvancedInput.advancedInput.startedAt);
15 | console.log(e.year());
16 | console.log(e.month() + 1);
17 | console.log(e.date());
18 |
19 | myAdvancedInput.dispatch({
20 | type: 'updateStartedAt',
21 | payload: { year: e.year(), month: e.month() + 1, day: e.date() },
22 | });
23 | };
24 |
25 | return (
26 |
27 |
28 |
29 |
30 |
37 |
38 |
39 |
40 |
41 | );
42 | }
43 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/PrivateCheckBox.tsx:
--------------------------------------------------------------------------------
1 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
2 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
3 | import Box from '@mui/joy/Box';
4 | import Checkbox from '@mui/joy/Checkbox';
5 | import { FormControl, FormLabel } from '@mui/joy';
6 |
7 | export default function PrivateCheckBox() {
8 | const myAdvancedMedia: any = useAdvancedMedia();
9 | const myAdvancedInput: any = useAdvancedInput();
10 |
11 | const onClick = (e: any) => {
12 | myAdvancedInput.dispatch({
13 | type: 'updatePrivate',
14 | payload: !myAdvancedInput.advancedInput.private,
15 | });
16 | };
17 |
18 | return (
19 |
27 |
28 |
29 | Private:
30 |
31 |
38 |
39 |
40 | );
41 | }
42 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/PrivateCheckBoxAlt.tsx:
--------------------------------------------------------------------------------
1 | import { Checkbox, FormControlLabel, FormGroup } from '@mui/material';
2 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 |
5 | export default function PrivateCheckBoxAlt() {
6 | const myAdvancedMedia: any = useAdvancedMedia();
7 | const myAdvancedInput: any = useAdvancedInput();
8 |
9 | const onClick = (e: any) => {
10 | myAdvancedInput.dispatch({
11 | type: 'updatePrivate',
12 | payload: !myAdvancedInput.advancedInput.private,
13 | });
14 | };
15 |
16 | return (
17 |
21 |
24 | }
25 | onClick={onClick}
26 | sx={{ alignSelf: 'start', margin: 0 }}
27 | checked={myAdvancedInput.advancedInput.private}
28 | label="Private:"
29 | labelPlacement="top"
30 | />
31 |
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/entryInput/onList/ScoreInput.tsx:
--------------------------------------------------------------------------------
1 | import { FormControl, FormLabel, Input } from '@mui/joy';
2 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 |
5 | export default function ScoreInput() {
6 | const myAdvancedMedia: any = useAdvancedMedia();
7 | const myAdvancedInput: any = useAdvancedInput();
8 |
9 | const onChange = (e: any) => {
10 | const value = e.target.value
11 | .replace(/[^0-9.]+/g, '')
12 | .replace(/^(?:0+(?=[1-9])|0+(?=0$))/gm, ''); // removes all leading 0's except 0
13 | console.log(parseFloat(value).toFixed(1) || 0);
14 |
15 | const maxValue = 10;
16 | let isMaxNull = false;
17 | if (maxValue === null) {
18 | isMaxNull = true;
19 | }
20 | if (isMaxNull) {
21 | if (parseFloat(value) > 10) {
22 | myAdvancedInput.dispatch({
23 | type: 'updateScore',
24 | payload: 10,
25 | });
26 | } else {
27 | myAdvancedInput.dispatch({
28 | type: 'updateScore',
29 | payload: value, // leave it like this
30 | });
31 | }
32 | }
33 | if (!isMaxNull) {
34 | if (parseFloat(value) > maxValue) {
35 | myAdvancedInput.dispatch({
36 | type: 'updateScore',
37 | payload: maxValue,
38 | });
39 | } else {
40 | myAdvancedInput.dispatch({
41 | type: 'updateScore',
42 | payload: value, // leave it like this
43 | });
44 | }
45 | }
46 | };
47 |
48 | return (
49 |
50 | Score:
51 |
56 | ['e', 'E', '+', '-'].includes(evt.key) && evt.preventDefault()
57 | }
58 | slotProps={{
59 | input: {
60 | min: 0,
61 | max: 10,
62 | step: 0.1,
63 | },
64 | }}
65 | sx={{ marginRight: '10px' }}
66 | onChange={onChange}
67 | />
68 |
69 | );
70 | }
71 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/AdvancedExtra.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from '@mui/material';
2 | import { useTheme } from 'renderer/context/ThemeContext';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 | import { useAtomValue } from 'jotai';
5 | import { infoTypeAtom } from 'renderer/store';
6 | import ThemeSongButton from './ThemeSongButton';
7 | import TrailerButton from './TrailerButton';
8 | import AdvancedExtraSelect from './AdvancedExtraSelect';
9 |
10 | const ButtonBox = () => {
11 | const infoType = useAtomValue(infoTypeAtom);
12 | if (infoType === 1) {
13 | return ;
14 | }
15 | if (infoType === 2) {
16 | return ;
17 | }
18 | return ;
19 | };
20 |
21 | export default function AdvancedExtra({ props }: any) {
22 | const myMediaAdvanced: any = useAdvancedMedia();
23 | const myTheme: any = useTheme();
24 |
25 | return (
26 |
37 |
38 | {/* myMediaAdvanced.advancedMedia.type === 'ANIME' ? (
39 |
40 | ) : null
41 |
42 | */}
43 |
44 | );
45 | }
46 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/AlternativeLink.tsx:
--------------------------------------------------------------------------------
1 | import OpenInNewIcon from '@mui/icons-material/OpenInNew';
2 | import { IconButton, Tooltip } from '@mui/material';
3 | import { useAdvancedDefaultLink } from 'renderer/context/advanced/AdvancedDefaultLinkContext';
4 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
5 | import { getMalLink } from 'renderer/functions/edit/getAdjustedSiteLink';
6 |
7 | export default function AlternativeLink({ props }: any) {
8 | const myAdvancedMedia: any = useAdvancedMedia();
9 | const myAdvancedDefaultLink: any = useAdvancedDefaultLink();
10 |
11 | const handleOnClick = () => {
12 | if (myAdvancedDefaultLink.advancedDefaultLink === 'MyAnimeList') {
13 | // AniList
14 | window.electron.ipcRenderer.sendMessage('openExternalLink', [
15 | myAdvancedMedia.advancedMedia.siteUrl,
16 | ]);
17 | } else {
18 | // MyAnimeList
19 | window.electron.ipcRenderer.sendMessage('openExternalLink', [
20 | getMalLink(
21 | myAdvancedMedia.advancedMedia.idMal,
22 | myAdvancedMedia.advancedMedia.type,
23 | ),
24 | ]);
25 | }
26 | };
27 |
28 | return (
29 |
36 |
37 |
38 |
39 |
40 | );
41 | }
42 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/DeleteButton.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Button } from '@mui/joy';
2 | import React from 'react';
3 | import DeleteIcon from '@mui/icons-material/Delete';
4 | import { useAtom } from 'jotai';
5 | import { infoTypeAtom } from 'renderer/store';
6 | import { useAniListUsername } from 'renderer/context/services/AniListUsernameContext';
7 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
8 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
9 | import { useDeleteEntryData } from 'renderer/functions/api/mutations/deleteEntry';
10 | import { useAdvancedInput } from 'renderer/context/advanced/AdvancedInputContext';
11 |
12 | const DeleteButton = () => {
13 | const [infoType, setInfoType] = useAtom(infoTypeAtom);
14 | const myUserName: any = useAniListUsername();
15 | const myToken: any = useAniListToken();
16 | const myAdvancedMedia: any = useAdvancedMedia();
17 | const deleteMutation: any = useDeleteEntryData();
18 | const myAdvancedInput: any = useAdvancedInput();
19 | const onClick = () => {
20 | setInfoType(0);
21 | console.log('deleted');
22 | const entry: any = {
23 | myUserName: myUserName.AniListUsername,
24 | myToken: myToken.AniListToken,
25 | myMediaId: myAdvancedMedia.advancedMedia.id,
26 | mediaListEntry: myAdvancedInput.advancedInput,
27 | advancedMedia: myAdvancedMedia.advancedMedia,
28 | };
29 | deleteMutation.mutate(entry);
30 | };
31 |
32 | return (
33 |
40 |
41 |
42 | Remove from List
43 |
44 |
45 | );
46 | };
47 |
48 | export default DeleteButton;
49 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/InfoButton.tsx:
--------------------------------------------------------------------------------
1 | import { IconButton, Tooltip } from '@mui/material';
2 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
3 |
4 | import InfoIcon from '@mui/icons-material/Info';
5 | import { useAdvancedMoreInfo } from 'renderer/context/advanced/AdvancedMoreInfoContext';
6 |
7 | export default function InfoButton({ props }: any) {
8 | const myMediaAdvanced: any = useAdvancedMedia();
9 | const advancedMoreInfo: any = useAdvancedMoreInfo();
10 |
11 | const handleOnClick = () => {
12 | console.log('more info');
13 | advancedMoreInfo.setAdvancedMoreInfo(!advancedMoreInfo.advancedMoreInfo);
14 | };
15 |
16 | return (
17 |
18 |
19 |
20 |
21 |
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/ThemeSongButton.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Tooltip, Typography } from '@mui/material';
2 | import MusicVideoIcon from '@mui/icons-material/MusicVideo';
3 | import axios from 'axios';
4 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
5 | import { useState } from 'react';
6 | import { useAdvancedThemeSongs } from 'renderer/context/advanced/AdvancedThemeSongContext';
7 | import { Button } from '@mui/joy';
8 |
9 | export default function ThemeSongButton({ props }: any) {
10 | const myMediaAdvanced: any = useAdvancedMedia();
11 | const { advancedThemeSongs, setAdvancedThemeSongs }: any =
12 | useAdvancedThemeSongs();
13 | const getData = async () => {
14 | const { data } = await axios.get(
15 | `https://api.jikan.moe/v4/anime/${myMediaAdvanced.advancedMedia.idMal}/themes`,
16 | );
17 | console.log(data);
18 | setAdvancedThemeSongs(data.data);
19 | };
20 |
21 | const handleOnClick = async () => {
22 | getData();
23 | };
24 |
25 | return (
26 |
27 |
28 |
34 |
35 | Get Theme Songs
36 |
37 |
38 |
39 | );
40 | }
41 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/extra/TrailerButton.tsx:
--------------------------------------------------------------------------------
1 | import YouTubeIcon from '@mui/icons-material/YouTube';
2 | import { Button, Typography } from '@mui/joy';
3 | import { Link } from 'react-router-dom';
4 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
5 |
6 | export default function TrailerButton({ props }: any) {
7 | const myMediaAdvanced: any = useAdvancedMedia();
8 |
9 | return (
10 |
18 |
19 |
20 | Watch Trailer
21 |
22 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedInformationDelete.tsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react';
2 | import { Box } from '@mui/material';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 | import DeleteButton from '../extra/DeleteButton';
5 |
6 | const AdvancedInformationDelete = () => {
7 | const myAdvancedMedia: any = useAdvancedMedia();
8 |
9 | const textGenresRef: any = useState(null);
10 |
11 | const [isOverflowedGenres, setIsOverflowGenres] = useState(false);
12 |
13 | useEffect(() => {
14 | setIsOverflowGenres(
15 | textGenresRef?.current?.scrollWidth > textGenresRef?.current?.clientWidth,
16 | );
17 | }, [textGenresRef, myAdvancedMedia]);
18 |
19 | const textStudioRef: any = useState(null);
20 |
21 | const [isOverflowedStudio, setIsOverflowStudio] = useState(false);
22 |
23 | useEffect(() => {
24 | setIsOverflowStudio(
25 | textStudioRef?.current?.scrollWidth > textStudioRef?.current?.clientWidth,
26 | );
27 | }, [textStudioRef, myAdvancedMedia]);
28 |
29 | const textTagsRef: any = useState(null);
30 |
31 | const [isOverflowedTags, setIsOverflowTags] = useState(false);
32 |
33 | useEffect(() => {
34 | setIsOverflowTags(
35 | textTagsRef?.current?.scrollWidth > textTagsRef?.current?.clientWidth,
36 | );
37 | }, [textTagsRef, myAdvancedMedia]);
38 |
39 | return (
40 |
41 |
42 |
43 | );
44 | };
45 |
46 | export default AdvancedInformationDelete;
47 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedInformationTrailer.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from '@mui/material';
2 | import React from 'react';
3 | import TrailerButton from '../extra/TrailerButton';
4 |
5 | const AdvancedInformationTrailer = () => {
6 | return (
7 |
8 |
9 |
10 | );
11 | };
12 |
13 | export default AdvancedInformationTrailer;
14 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaAverageScore.tsx:
--------------------------------------------------------------------------------
1 | export default function AdvancedMediaAverageScore() {
2 | return AdvancedMediaAverageScore
;
3 | }
4 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaGenres.tsx:
--------------------------------------------------------------------------------
1 | export default function AdvancedMediaGenres() {
2 | return AdvancedMediaGenres
;
3 | }
4 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaSeason.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaSeason() {
4 | return AdvancedMediaSeason
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaStatus.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaStatus() {
4 | return AdvancedMediaStatus
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaStudio.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaStudio() {
4 | return AdvancedMediaStudio
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaSynonyms.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaSynonyms() {
4 | return AdvancedMediaSynonyms
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaThemes.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaThemes() {
4 | return AdvancedMediaThemes
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/information/AdvancedMediaType.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export default function AdvancedMediaType() {
4 | return AdvancedMediaType
;
5 | }
6 |
--------------------------------------------------------------------------------
/src/renderer/components/mediaAdvanced/title/AdvancedTitle.tsx:
--------------------------------------------------------------------------------
1 | import { Tooltip } from '@mui/joy';
2 | import { Card, CardContent, Typography } from '@mui/material';
3 | import { useEffect, useState } from 'react';
4 | import { useTitle } from 'renderer/context/TitleContext';
5 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
6 | import { getTitle } from 'renderer/functions/view/TitlePreferenceFunctions';
7 |
8 | export default function AdvancedTitle() {
9 | const myAdvancedMedia: any = useAdvancedMedia();
10 | const titlePreference: any = useTitle();
11 | const textElementRef: any = useState(null);
12 |
13 | const [isOverflowed, setIsOverflow] = useState(false);
14 |
15 | useEffect(() => {
16 | setIsOverflow(
17 | textElementRef?.current?.scrollWidth >
18 | textElementRef?.current?.clientWidth,
19 | );
20 | }, [textElementRef, myAdvancedMedia]);
21 |
22 | return (
23 |
32 |
33 |
41 |
47 | {getTitle(titlePreference.title, myAdvancedMedia.advancedMedia)}
48 |
49 |
50 |
51 |
52 | );
53 | }
54 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/TestButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from '@mui/material';
2 |
3 | export default function TestButton() {
4 | return (
5 | {
7 | console.log(window.electron.store.get('theme'));
8 | console.log(window.electron.store.get('aniListUsername'));
9 | console.log(window.electron.store.get('aniListToken'));
10 | }}
11 | >
12 | test
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/AdultLabel.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Checkbox, FormControlLabel, FormGroup } from '@mui/material';
2 | import { useAdult } from 'renderer/context/AdultContext';
3 | import { useAniListToken } from 'renderer/context/services/AniListTokenContext';
4 | import { useAniListUsername } from 'renderer/context/services/AniListUsernameContext';
5 | import { getUser } from 'renderer/functions/UserFunctions';
6 |
7 | function AdultLabel() {
8 | const adult: any = useAdult();
9 | const myToken: any = useAniListToken();
10 | const myUsername: any = useAniListUsername();
11 |
12 | const handleChange = async (event: any) => {
13 | await adult.setAdult(event.target.checked);
14 | if (event.target.checked) {
15 | window.electron.ipcRenderer.sendMessage('adultFlag', [
16 | event.target.checked,
17 | ]);
18 | console.log(adult);
19 | console.log(event.target.checked);
20 | console.log(
21 | getUser({
22 | username: myUsername.AniListUsername,
23 | myToken: myToken.AniListToken,
24 | adult: true,
25 | }),
26 | );
27 | /* console.log(
28 | changeUserAdult({
29 | username: myUsername.AniListUsername,
30 | myToken: myToken.AniListToken,
31 | adult: true,
32 | }),
33 | ); */
34 | }
35 | if (!event.target.checked) {
36 | window.electron.ipcRenderer.sendMessage('adultFlag', [
37 | event.target.checked,
38 | ]);
39 | console.log(event.target.checked);
40 | console.log(
41 | getUser({
42 | username: myUsername.AniListUsername,
43 | myToken: myToken.AniListToken,
44 | adult: true,
45 | }),
46 | );
47 | /* console.log(
48 | changeUserAdult({
49 | username: myUsername.AniListUsername,
50 | myToken: myToken.AniListToken,
51 | adult: false,
52 | }),
53 | ); */
54 | }
55 | };
56 |
57 | return (
58 |
59 |
60 | }
62 | label="18+ Content"
63 | onChange={handleChange}
64 | />
65 |
66 |
67 | );
68 | }
69 |
70 | export default AdultLabel;
71 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/DefaultStatus.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import { useAtom } from 'jotai';
3 | import React from 'react';
4 | import { statusAddSelectAtom } from 'renderer/store';
5 |
6 | const DefaultStatus = () => {
7 | const [defaultAddStatus, setDefaultAddStatus] = useAtom(statusAddSelectAtom);
8 |
9 | const handleChange = (event: any) => {
10 | console.log(event.target.value);
11 | setDefaultAddStatus(event.target.value);
12 | window.electron.store.set('defaultAddStatus', event.target.value);
13 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
14 | 'addStatus',
15 | event.target.value,
16 | ]);
17 | };
18 |
19 | return (
20 |
21 |
22 |
23 | Add To List
24 |
25 |
30 | Watching/Reading
31 | Completed
32 | On Hold
33 | Dropped
34 | Planning
35 |
36 |
37 |
38 | );
39 | };
40 |
41 | export default DefaultStatus;
42 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/NextAiringEpisodeMainList.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import { useAtom } from 'jotai';
3 | import React from 'react';
4 | import { nextAiringEpisodeAtom } from 'renderer/store';
5 |
6 | function NextAiringEpisodeMainList() {
7 | const [nextAiringEpisode, setNextAiringEpisode] = useAtom(
8 | nextAiringEpisodeAtom,
9 | );
10 |
11 | const handleChange = (event: any) => {
12 | setNextAiringEpisode(event.target.value as string);
13 | window.electron.store.set('nextAiringEpisode', event.target.value);
14 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
15 | 'nextAiringEpisode',
16 | event.target.value,
17 | ]);
18 | };
19 |
20 | return (
21 |
22 |
23 |
24 | Next Airing Episode (Main List)
25 |
26 |
31 | Show
32 | Hide
33 |
34 |
35 |
36 | );
37 | }
38 |
39 | export default NextAiringEpisodeMainList;
40 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/SelectDefaultLink.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import React from 'react';
3 | import { useAdvancedDefaultLink } from 'renderer/context/advanced/AdvancedDefaultLinkContext';
4 |
5 | function SelectDefaultLink() {
6 | const myAdvancedDefaultLink: any = useAdvancedDefaultLink();
7 |
8 | const handleChange = (event: any) => {
9 | myAdvancedDefaultLink.setAdvancedDefaultLink(event.target.value as string);
10 | window.electron.store.set('defaultLink', event.target.value);
11 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
12 | 'defaultLink',
13 | event.target.value,
14 | ]);
15 | };
16 |
17 | return (
18 |
19 |
20 |
21 | Image Links
22 |
23 |
28 | AniList
29 | MyAnimeList
30 |
31 |
32 |
33 | );
34 | }
35 |
36 | export default SelectDefaultLink;
37 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/SelectDefaultSeasonsSort.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import { useAtom } from 'jotai';
3 | import React from 'react';
4 | import { defaultSeasonSortAtom } from 'renderer/store';
5 |
6 | function SelectDefaultSeasonsSort() {
7 | const [defaultSeasonSort, setDefaultSeasonSort] = useAtom(
8 | defaultSeasonSortAtom,
9 | );
10 |
11 | const handleChange = (event: any) => {
12 | setDefaultSeasonSort(Number(event.target.value));
13 | window.electron.store.set('defaultSeasonSort', Number(event.target.value));
14 | /*
15 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
16 | 'defaultSeasonSort',
17 | event.target.value,
18 | ]);
19 | */
20 | };
21 |
22 | return (
23 |
24 |
25 | Seasonal Sort
26 |
31 | Next Airing Time
32 | Popularity
33 | Score
34 | Status
35 | Title
36 | Episodes
37 |
38 |
39 |
40 | );
41 | }
42 |
43 | export default SelectDefaultSeasonsSort;
44 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/SelectDefaultView.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import React from 'react';
3 | import { useMainView } from 'renderer/context/MainViewContext';
4 |
5 | const SelectDefaultView = () => {
6 | const myMainView: any = useMainView();
7 |
8 | const handleChange = (event: any) => {
9 | myMainView.setView(event.target.value);
10 | window.electron.store.set('defaultView', Number(event.target.value));
11 | };
12 |
13 | return (
14 |
15 |
16 |
17 | List View Type
18 |
19 |
24 | Grid
25 | Compact
26 | List
27 |
28 |
29 |
30 | );
31 | };
32 |
33 | export default SelectDefaultView;
34 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/app/SelectSeasonChange.tsx:
--------------------------------------------------------------------------------
1 | import { Box, FormControl, InputLabel, NativeSelect } from '@mui/material';
2 | import { useAtom } from 'jotai';
3 | import React from 'react';
4 | import { seasonChangeAtom } from 'renderer/store';
5 |
6 | function SelectSeasonChange() {
7 | const [seasonChange, setSeasonChange] = useAtom(seasonChangeAtom);
8 |
9 | const handleChange = (event: any) => {
10 | setSeasonChange(event.target.value as string);
11 | window.electron.store.set('seasonChange', event.target.value);
12 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
13 | 'seasonChange',
14 | event.target.value,
15 | ]);
16 | };
17 |
18 | return (
19 |
20 |
21 |
22 | Season Change
23 |
24 |
29 | Early (beginning of Dec/Mar/Jun/Sep)
30 |
31 | Standard (beginning of Jan/Apr/July/Oct)
32 |
33 |
34 |
35 |
36 | );
37 | }
38 |
39 | export default SelectSeasonChange;
40 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/etc/CardContentPaddingAdjusted.tsx:
--------------------------------------------------------------------------------
1 | import { CardContent, styled } from '@mui/material';
2 |
3 | const CardContentPaddingAdjusted = styled(CardContent)(`
4 | &:last-child {
5 | padding-bottom: 10px;
6 | }
7 | `);
8 |
9 | export default CardContentPaddingAdjusted;
10 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/etc/CustomSettingsTooltip.tsx:
--------------------------------------------------------------------------------
1 | import { styled } from '@mui/material';
2 | import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
3 |
4 | const CustomSettingsTooltip = styled(
5 | ({ className, ...props }: TooltipProps) => (
6 | // eslint-disable-next-line react/jsx-props-no-spreading
7 |
8 | ),
9 | )(({ theme }) => ({
10 | [`& .${tooltipClasses.tooltip}`]: {
11 | backgroundColor: '#0b0d0e',
12 | color: '#86b9db', // #86b9db
13 | fontSize: theme.typography.pxToRem(12),
14 | border: '1px solid #4383ce', // #4383ce
15 | maxWidth: 450,
16 | },
17 | }));
18 |
19 | export default CustomSettingsTooltip;
20 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/etc/SaveButton.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { Button } from '@mui/material';
3 |
4 | export default function SaveButton() {
5 | const handleClickOpen = () => {
6 | window.electron.store.set('aniListUsername', 'ReStart');
7 | window.electron.store.set('aniListToken', 'test');
8 | };
9 |
10 | return (
11 |
12 | Save
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/etc/SubmitButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from '@mui/material';
2 |
3 | export default function SubmitButton() {
4 | const handleClickOpen = () => {
5 | console.log('test');
6 | };
7 |
8 | return (
9 |
15 | Login with AniList
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/lang/SelectLanguage.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import InputLabel from '@mui/material/InputLabel';
4 | import FormControl from '@mui/material/FormControl';
5 | import { useTitle } from 'renderer/context/TitleContext';
6 | import { NativeSelect } from '@mui/material';
7 |
8 | export default function SelectLanguage() {
9 | const [age, setAge] = React.useState('');
10 | const titlePreference: any = useTitle();
11 |
12 | const handleChange = (event: any) => {
13 | titlePreference.setTitle(event.target.value as string);
14 | window.electron.store.set('titlePreference', event.target.value);
15 | window.electron.ipcRenderer.sendMessage('updateMainFromSettings', [
16 | 'titlePreference',
17 | event.target.value,
18 | ]);
19 | };
20 |
21 | return (
22 |
23 |
24 |
25 | Title Language
26 |
27 |
32 | Romaji
33 | English
34 | Native
35 |
36 |
37 |
38 | );
39 | }
40 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/ResetLoginButton.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { Button } from '@mui/material';
3 |
4 | export default function ResetLoginButton() {
5 | const handleClickOpen = () => {
6 | window.electron.ipcRenderer.sendMessage('resetLogin', ['ping']);
7 | };
8 |
9 | return (
10 |
11 | Reset Login
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/SelectList.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import InputLabel from '@mui/material/InputLabel';
4 | import MenuItem from '@mui/material/MenuItem';
5 | import FormControl from '@mui/material/FormControl';
6 | import Select, { SelectChangeEvent } from '@mui/material/Select';
7 | import { useNewsServiceType } from 'renderer/context/NewsServiceTypeContext';
8 |
9 | export default function SelectList() {
10 | const newsServiceType: any = useNewsServiceType();
11 | const handleChange = async (event: SelectChangeEvent) => {
12 | console.log('test');
13 | };
14 |
15 | return (
16 |
17 |
18 | List
19 |
26 | MyAnimeList
27 | AniList
28 |
29 |
30 |
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/SelectNews.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import InputLabel from '@mui/material/InputLabel';
4 | import MenuItem from '@mui/material/MenuItem';
5 | import FormControl from '@mui/material/FormControl';
6 | import Select, { SelectChangeEvent } from '@mui/material/Select';
7 | import { useNewsServiceType } from 'renderer/context/NewsServiceTypeContext';
8 |
9 | export default function SelectNews() {
10 | const newsServiceType: any = useNewsServiceType();
11 | const handleChange = async (event: SelectChangeEvent) => {
12 | await newsServiceType.toggleNews();
13 | if (event.target.value === 'MyAnimeList') {
14 | window.electron.ipcRenderer.sendMessage('changeNews', [true]);
15 | }
16 | if (event.target.value === 'AnimeNewsNetwork') {
17 | window.electron.ipcRenderer.sendMessage('changeNews', [false]);
18 | }
19 | };
20 |
21 | return (
22 |
23 |
24 | News
25 |
33 | MyAnimeList
34 | AnimeNewsNetwork
35 |
36 |
37 |
38 | );
39 | }
40 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/TokenButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from '@mui/material';
2 |
3 | export default function TokenButton() {
4 | const handleClickOpen = () => {
5 | console.log('test');
6 | };
7 | const authLink = `https://anilist.co/api/v2/oauth/authorize?client_id=9413&response_type=token`;
8 |
9 | return (
10 |
17 | Login with AniList
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/TokenInput.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import { Input } from '@mui/material';
4 |
5 | const ariaLabel = { 'aria-label': 'description' };
6 |
7 | export default function TokenInput() {
8 | return (
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/services/UsernameInput.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import { Input } from '@mui/material';
4 |
5 | const ariaLabel = { 'aria-label': 'description' };
6 |
7 | export default function UsernameInput() {
8 | return (
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/src/renderer/components/settings/theme/SelectTheme.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import Box from '@mui/material/Box';
3 | import InputLabel from '@mui/material/InputLabel';
4 | import MenuItem from '@mui/material/MenuItem';
5 | import FormControl from '@mui/material/FormControl';
6 | import Select, { SelectChangeEvent } from '@mui/material/Select';
7 |
8 | export default function SelectTheme() {
9 | const [age, setAge] = React.useState('');
10 |
11 | const handleChange = (event: SelectChangeEvent) => {
12 | setAge(event.target.value as string);
13 | };
14 |
15 | return (
16 |
17 |
18 | Theme
19 |
26 | Dark
27 | Light
28 |
29 |
30 |
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/src/renderer/components/trailer/MyTrailer.tsx:
--------------------------------------------------------------------------------
1 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
2 | import 'renderer/styles/Trailer.scss';
3 |
4 | export default function MyTrailer({ props }: any) {
5 | const myAdvancedMedia: any = useAdvancedMedia();
6 |
7 | if (myAdvancedMedia.advancedMedia.trailer.site === 'youtube') {
8 | return (
9 | VIDEO
17 | );
18 | }
19 | if (myAdvancedMedia.advancedMedia.trailer.site === 'dailymotion') {
20 | return (
21 |
29 | );
30 | }
31 |
32 | return (
33 |
41 | );
42 | }
43 | // check if trailer is null + on youtube
44 |
--------------------------------------------------------------------------------
/src/renderer/components/trailer/TrailerAvailablePage.tsx:
--------------------------------------------------------------------------------
1 | import { Box, IconButton } from '@mui/material';
2 | import { useEffect, useState } from 'react';
3 | import { Link } from 'react-router-dom';
4 | import { useTheme } from 'renderer/context/ThemeContext';
5 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
6 | import ArrowBackIcon from '@mui/icons-material/ArrowBack';
7 | import { useColorScheme as useJoyColorScheme } from '@mui/joy/styles';
8 | import { useColorScheme as useMaterialColorScheme } from '@mui/material/styles';
9 | import 'renderer/styles/Trailer.scss';
10 | import MyTrailer from './MyTrailer';
11 |
12 | export default function TrailerAvailablePage({ props }: any) {
13 | const myTheme: any = useTheme();
14 | const myAdvancedMedia: any = useAdvancedMedia();
15 | const { setMode: setJoyMode } = useJoyColorScheme();
16 | const { mode, setMode: setMaterialMode } = useMaterialColorScheme();
17 | const [mounted, setMounted] = useState(false);
18 |
19 | useEffect(() => {
20 | if (myTheme.theme === true) {
21 | setJoyMode('dark');
22 | setMaterialMode('dark');
23 | } else {
24 | setJoyMode('light');
25 | setMaterialMode('light');
26 | }
27 | }, [myTheme, setJoyMode, setMaterialMode]);
28 |
29 | return (
30 |
31 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | );
47 | }
48 | // check if trailer is null + on youtube
49 |
--------------------------------------------------------------------------------
/src/renderer/components/trailer/TrailerNotAvailablePage.tsx:
--------------------------------------------------------------------------------
1 | import { Box, IconButton, Typography } from '@mui/material';
2 | import { Link } from 'react-router-dom';
3 | import { useAdvancedMedia } from 'renderer/context/advanced/AdvancedMediaContext';
4 | import ArrowBackIcon from '@mui/icons-material/ArrowBack';
5 | import { useColorScheme as useJoyColorScheme } from '@mui/joy/styles';
6 | import { useColorScheme as useMaterialColorScheme } from '@mui/material/styles';
7 | import { useTheme } from 'renderer/context/ThemeContext';
8 | import { useEffect, useState } from 'react';
9 |
10 | export default function TrailerNotAvailablePage({ props }: any) {
11 | const myTheme: any = useTheme();
12 | const myAdvancedMedia: any = useAdvancedMedia();
13 |
14 | const { setMode: setJoyMode } = useJoyColorScheme();
15 | const { mode, setMode: setMaterialMode } = useMaterialColorScheme();
16 | const [mounted, setMounted] = useState(false);
17 |
18 | useEffect(() => {
19 | if (myTheme.theme === true) {
20 | setJoyMode('dark');
21 | setMaterialMode('dark');
22 | } else {
23 | setJoyMode('light');
24 | setMaterialMode('light');
25 | }
26 | }, [myTheme, setJoyMode, setMaterialMode]);
27 |
28 | return (
29 |
30 |
39 |
40 |
41 |
42 |
43 |
44 | No trailer
45 |
46 |
47 | );
48 | }
49 |
--------------------------------------------------------------------------------
/src/renderer/context/AdultContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type AdultContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const AdultContext = createContext({});
8 |
9 | export const useAdult = () => {
10 | return useContext(AdultContext);
11 | };
12 |
13 | export const AdultContextProvider = ({
14 | children,
15 | }: AdultContextProviderProps) => {
16 | const [adult, setAdult] = useState(window.electron.store.get('isAdult'));
17 |
18 | return (
19 |
20 | {children}
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/src/renderer/context/CategoryContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const CategoryContext = createContext({});
4 |
5 | type CategoryButtonContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useCategory = () => {
10 | return useContext(CategoryContext);
11 | };
12 |
13 | export const CategoryContextProvider = ({
14 | children,
15 | }: CategoryButtonContextProviderProps) => {
16 | const [category, setCategory] = useState(0);
17 |
18 | return (
19 |
20 | {children}
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/src/renderer/context/CategoryCountContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const CategoryCountContext = createContext({});
4 |
5 | type CategoryCountButtonContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useCategoryCount = () => {
10 | return useContext(CategoryCountContext);
11 | };
12 |
13 | export const CategoryCountContextProvider = ({
14 | children,
15 | }: CategoryCountButtonContextProviderProps) => {
16 | const [categoryCount, setCategoryCount] = useState(0);
17 | // object that tracks the number of anime for the category (watching, reading, reading2, completed, etc)
18 | // find a way to go to electron store from this context and communicate it with a function
19 | // window.electron.ipcRenderer.sendMessage('settings', ['ping'])
20 | const sendMessageToElectronStore = () => {
21 | window.electron.ipcRenderer.sendMessage('settings', ['ping']);
22 | };
23 |
24 | return (
25 |
26 | {children}
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/src/renderer/context/CategoryLastContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | createContext,
3 | useState,
4 | useContext,
5 | useReducer,
6 | ReactNode,
7 | } from 'react';
8 |
9 | type CategoryLastContextProviderProps = {
10 | children: ReactNode;
11 | };
12 |
13 | const defaultCategoryLast = {
14 | anime: 0,
15 | manga: 0,
16 | lightNovels: 0,
17 | search: 0,
18 | seasons: 0,
19 | };
20 |
21 | export const CategoryLastContext = createContext({});
22 |
23 | export const useCategoryLast = () => {
24 | return useContext(CategoryLastContext);
25 | };
26 |
27 | export const CategoryLastContextReducer = (state: any, action: any) => {
28 | switch (action.type) {
29 | case 'updateAnimeCategory':
30 | return {
31 | ...state,
32 | anime: action.payload,
33 | };
34 | case 'updateMangaCategory':
35 | return {
36 | ...state,
37 | manga: action.payload,
38 | };
39 | case 'updateLightNovelsCategory':
40 | return {
41 | ...state,
42 | lightNovels: action.payload,
43 | };
44 | case 'updateSearchCategory':
45 | return {
46 | ...state,
47 | search: action.payload,
48 | };
49 | case 'updateSeasonsCategory':
50 | return {
51 | ...state,
52 | seasons: action.payload,
53 | };
54 | default:
55 | return state;
56 | }
57 | };
58 |
59 | export const CategoryLastContextProvider = ({
60 | children,
61 | }: CategoryLastContextProviderProps) => {
62 | const [categoryLast, dispatch] = useReducer(
63 | CategoryLastContextReducer,
64 | defaultCategoryLast,
65 | );
66 |
67 | return (
68 |
69 | {children}
70 |
71 | );
72 | };
73 |
--------------------------------------------------------------------------------
/src/renderer/context/DefaultViewContext.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/context/DefaultViewContext.tsx
--------------------------------------------------------------------------------
/src/renderer/context/FilterContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useMemo, useState } from 'react';
2 |
3 | export const FilterContext = createContext({});
4 |
5 | type FilterContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useFilter = () => {
10 | return useContext(FilterContext);
11 | };
12 |
13 | export const FilterContextProvider = ({
14 | children,
15 | }: FilterContextProviderProps) => {
16 | const [filter, setFilter] = useState('');
17 | const value = useMemo(() => {
18 | return { filter, setFilter };
19 | }, [filter]);
20 |
21 | return (
22 |
25 | {children}
26 |
27 | );
28 | };
29 |
--------------------------------------------------------------------------------
/src/renderer/context/FilteredListContext.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/context/FilteredListContext.tsx
--------------------------------------------------------------------------------
/src/renderer/context/ListServiceTypeContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type ListServiceTypeContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const ListServiceTypeContext = createContext({});
8 |
9 | export const useListServiceType = () => {
10 | return useContext(ListServiceTypeContext);
11 | };
12 |
13 | export const ListServiceTypeContextProvider = ({
14 | children,
15 | }: ListServiceTypeContextProviderProps) => {
16 | const [listServiceType, setListServiceType] = useState(false);
17 |
18 | const toggleListServiceType = () => {
19 | setListServiceType(!listServiceType);
20 | };
21 |
22 | return (
23 |
26 | {children}
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/src/renderer/context/MainViewContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type MainViewContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const MainViewContext = createContext({});
8 |
9 | export const useMainView = () => {
10 | return useContext(MainViewContext);
11 | };
12 |
13 | export const MainViewContextProvider = ({
14 | children,
15 | }: MainViewContextProviderProps) => {
16 | const [view, setView] = useState(window.electron.store.get('defaultView'));
17 |
18 | return (
19 |
20 | {children}
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/src/renderer/context/NewsAdvContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type NewsContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const NewsAdvContext = createContext({});
8 |
9 | export const useNewsAdv = () => {
10 | return useContext(NewsAdvContext);
11 | };
12 |
13 | export const NewsAdvContextProvider = ({
14 | children,
15 | }: NewsContextProviderProps) => {
16 | const [news, setNews] = useState(true);
17 |
18 | const toggleNews = () => {
19 | setNews(!news);
20 | };
21 |
22 | return (
23 |
24 | {children}
25 |
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/src/renderer/context/NewsAnnContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const NewsAnnContext = createContext({});
10 |
11 | type NewsAnnContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useNewsAnn = () => {
16 | return useContext(NewsAnnContext);
17 | };
18 | export const NewsAnnList: any = [
19 | {
20 | title: '',
21 | text: '',
22 | link: '',
23 | published: '',
24 | category: '',
25 | key: 0,
26 | },
27 | ];
28 |
29 | export const NewsAnnContextProvider = ({
30 | children,
31 | }: NewsAnnContextProviderProps) => {
32 | const [NewsAnn, setNewsAnn] = useState([]);
33 |
34 | return (
35 |
36 | {children}
37 |
38 | );
39 | };
40 |
--------------------------------------------------------------------------------
/src/renderer/context/NewsContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const NewsContext = createContext({});
10 |
11 | type NewsContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useNews = () => {
16 | return useContext(NewsContext);
17 | };
18 | export const NewsList: any = [
19 | {
20 | title: '',
21 | text: '',
22 | link: '',
23 | published: '',
24 | category: '',
25 | key: 0,
26 | },
27 | ];
28 |
29 | export const NewsContextProvider = ({ children }: NewsContextProviderProps) => {
30 | const [News, setNews] = useState([]);
31 |
32 | return (
33 |
34 | {children}
35 |
36 | );
37 | };
38 |
--------------------------------------------------------------------------------
/src/renderer/context/NewsInfoContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const NewsInfoContext = createContext({});
10 |
11 | type NewsInfoContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useNewsInfo = () => {
16 | return useContext(NewsInfoContext);
17 | };
18 |
19 | export const NewsInfoContextProvider = ({
20 | children,
21 | }: NewsInfoContextProviderProps) => {
22 | const [NewsInfo, setNewsInfo] = useState({
23 | title: '',
24 | titleURL: '',
25 | author: '',
26 | authorUrl: '',
27 | main: '',
28 | date: '',
29 | });
30 |
31 | return (
32 |
33 | {children}
34 |
35 | );
36 | };
37 |
--------------------------------------------------------------------------------
/src/renderer/context/NewsServiceTypeContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type NewsContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const NewsServiceTypeContext = createContext({});
8 |
9 | export const useNewsServiceType = () => {
10 | return useContext(NewsServiceTypeContext);
11 | };
12 |
13 | export const NewsServiceTypeContextProvider = ({
14 | children,
15 | }: NewsContextProviderProps) => {
16 | const [news, setNews] = useState(
17 | window.electron.store.get('newsServiceType') === 'MyAnimeList',
18 | ); // true = myanimelist, false = animenewsnetwork
19 | const toggleNews = () => {
20 | setNews(!news);
21 | };
22 |
23 | return (
24 |
25 | {children}
26 |
27 | );
28 | };
29 |
--------------------------------------------------------------------------------
/src/renderer/context/SearchContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const SearchContext = createContext({});
10 |
11 | type SearchContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useSearch = () => {
16 | return useContext(SearchContext);
17 | };
18 |
19 | export const SearchContextProvider = ({
20 | children,
21 | }: SearchContextProviderProps) => {
22 | const [Search, setSearch] = useState([]);
23 |
24 | return (
25 |
26 | {children}
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/src/renderer/context/SearchTermContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const SearchTermContext = createContext({});
10 |
11 | type SearchTermContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useSearchTerm = () => {
16 | return useContext(SearchTermContext);
17 | };
18 |
19 | export const SearchTermContextProvider = ({
20 | children,
21 | }: SearchTermContextProviderProps) => {
22 | const [SearchTerm, setSearchTerm] = useState('');
23 |
24 | return (
25 |
26 | {children}
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/src/renderer/context/SeasonInputContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 | import { getMyDate } from 'renderer/functions/SeasonsFunctions';
3 |
4 | type SeasonInputButtonContextProviderProps = {
5 | children: ReactNode;
6 | };
7 |
8 | export const SeasonInputContext = createContext({});
9 |
10 | export const useSeasonInput = () => {
11 | return useContext(SeasonInputContext);
12 | };
13 |
14 | export const SeasonInputContextProvider = ({
15 | children,
16 | }: SeasonInputButtonContextProviderProps) => {
17 | const date = new Date();
18 | const standardDate = new Date();
19 | const earlyDate = new Date(date.setMonth(date.getMonth() + 1)); // sets 1 month after
20 |
21 | console.log(standardDate);
22 | console.log(earlyDate);
23 |
24 | const [seasonInput, setSeasonInput] = useState(
25 | getMyDate(
26 | window.electron.store.get('seasonChange') === 'Early'
27 | ? earlyDate
28 | : standardDate,
29 | ),
30 | );
31 |
32 | return (
33 |
34 | {children}
35 |
36 | );
37 | };
38 |
--------------------------------------------------------------------------------
/src/renderer/context/SeasonsContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ReactNode,
3 | createContext,
4 | useContext,
5 | useReducer,
6 | useState,
7 | } from 'react';
8 |
9 | export const SeasonContext = createContext({});
10 |
11 | type SeasonContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const useSeason = () => {
16 | return useContext(SeasonContext);
17 | };
18 | export const seasonList: any = [
19 | {
20 | titleRomaji: 'Hyouka',
21 | image: 'https://cdn.myanimelist.net/images/anime/1932/127228l.jpg',
22 | key: 0,
23 | },
24 | ];
25 |
26 | async function getSeasons() {
27 | console.log('h');
28 | }
29 |
30 | export const SeasonUpdater = (state: any, action: any) => {
31 | switch (action.type) {
32 | case 'Update':
33 | return [];
34 | case 'Add':
35 | return [];
36 | case 'Remove':
37 | return [];
38 | default:
39 | throw new Error();
40 | }
41 | };
42 |
43 | export const SeasonContextProvider = ({
44 | children,
45 | }: SeasonContextProviderProps) => {
46 | const [Season, setSeason] = useState([]);
47 |
48 | return (
49 |
50 | {children}
51 |
52 | );
53 | };
54 |
--------------------------------------------------------------------------------
/src/renderer/context/SidebarContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type SidebarButtonContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const SidebarContext = createContext({});
8 |
9 | export const useSidebarButton = () => {
10 | return useContext(SidebarContext);
11 | };
12 |
13 | export const SidebarContextProvider = ({
14 | children,
15 | }: SidebarButtonContextProviderProps) => {
16 | const [sidebar, setSidebar] = useState(0);
17 |
18 | return (
19 |
20 | {children}
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/src/renderer/context/SortContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type SortContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const SortContext = createContext({});
8 |
9 | export const useSort = () => {
10 | return useContext(SortContext);
11 | };
12 |
13 | export const SortContextProvider = ({ children }: SortContextProviderProps) => {
14 | const [sort, setSort] = useState(0);
15 |
16 | return (
17 |
18 | {children}
19 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/src/renderer/context/ThemeContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type ThemeContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const ThemeContext = createContext({});
8 |
9 | export const useTheme = () => {
10 | return useContext(ThemeContext);
11 | };
12 |
13 | export const ThemeContextProvider = ({
14 | children,
15 | }: ThemeContextProviderProps) => {
16 | const [theme, setTheme] = useState(window.electron.store.get('theme'));
17 |
18 | const toggleTheme = () => {
19 | setTheme(!theme);
20 | };
21 |
22 | return (
23 |
24 | {children}
25 |
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/src/renderer/context/TitleContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type TitleContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const TitleContext = createContext({});
8 |
9 | export const useTitle = () => {
10 | return useContext(TitleContext);
11 | };
12 |
13 | export const TitleContextProvider = ({
14 | children,
15 | }: TitleContextProviderProps) => {
16 | const [title, setTitle] = useState(
17 | window.electron.store.get('titlePreference'),
18 | );
19 |
20 | return (
21 |
22 | {children}
23 |
24 | );
25 | };
26 |
--------------------------------------------------------------------------------
/src/renderer/context/advanced/AdvancedDefaultLinkContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useContext, useState, ReactNode } from 'react';
2 |
3 | export const AdvancedDefaultLinkContext = createContext({});
4 |
5 | type AdvancedDefaultLinkButtonContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useAdvancedDefaultLink = () => {
10 | return useContext(AdvancedDefaultLinkContext);
11 | };
12 |
13 | export const AdvancedDefaultLinkContextProvider = ({
14 | children,
15 | }: AdvancedDefaultLinkButtonContextProviderProps) => {
16 | const [advancedDefaultLink, setAdvancedDefaultLink] = useState(
17 | window.electron.store.get('defaultLink'),
18 | );
19 | // values can be AniList or MyAnimeList
20 |
21 | return (
22 |
25 | {children}
26 |
27 | );
28 | };
29 |
--------------------------------------------------------------------------------
/src/renderer/context/advanced/AdvancedInputContext.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | createContext,
3 | useState,
4 | useReducer,
5 | useContext,
6 | ReactNode,
7 | } from 'react';
8 |
9 | const defaultMedia = null;
10 |
11 | type AdvancedInputContextProviderProps = {
12 | children: ReactNode;
13 | };
14 |
15 | export const AdvancedInputContext = createContext({});
16 |
17 | export const useAdvancedInput = () => {
18 | return useContext(AdvancedInputContext);
19 | };
20 |
21 | export const AdvancedInputContextReducer = (state: any, action: any) => {
22 | switch (action.type) {
23 | case 'getMediaListEntry':
24 | return action.payload;
25 | case 'updateProgress':
26 | return {
27 | ...state,
28 | progress: action.payload,
29 | };
30 | case 'updateProgressVolumes':
31 | return {
32 | ...state,
33 | progressVolumes: action.payload,
34 | };
35 | case 'updateRepeat':
36 | return {
37 | ...state,
38 | repeat: action.payload,
39 | };
40 | case 'updateStatus':
41 | return {
42 | ...state,
43 | status: action.payload,
44 | };
45 | case 'updateScore':
46 | return {
47 | ...state,
48 | score: action.payload,
49 | };
50 | case 'updateNotes':
51 | return {
52 | ...state,
53 | notes: action.payload,
54 | };
55 | case 'updateStartedAt':
56 | return {
57 | ...state,
58 | startedAt: action.payload,
59 | };
60 | case 'updateCompletedAt':
61 | return {
62 | ...state,
63 | completedAt: action.payload,
64 | };
65 | case 'updatePrivate':
66 | return {
67 | ...state,
68 | private: action.payload,
69 | };
70 | default:
71 | return state;
72 | }
73 | };
74 |
75 | export const AdvancedInputContextProvider = ({
76 | children,
77 | }: AdvancedInputContextProviderProps) => {
78 | // window.electron.store.get('advancedInput')
79 | const [advancedInput, dispatch] = useReducer(
80 | AdvancedInputContextReducer,
81 | defaultMedia,
82 | );
83 |
84 | return (
85 |
86 | {children}
87 |
88 | );
89 | };
90 |
--------------------------------------------------------------------------------
/src/renderer/context/advanced/AdvancedMoreInfoContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const AdvancedMoreInfoContext = createContext({});
4 |
5 | type AdvancedMoreInfoContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useAdvancedMoreInfo = () => {
10 | return useContext(AdvancedMoreInfoContext);
11 | };
12 |
13 | export const AdvancedMoreInfoContextProvider = ({
14 | children,
15 | }: AdvancedMoreInfoContextProviderProps) => {
16 | const [advancedMoreInfo, setAdvancedMoreInfo] = useState(false);
17 |
18 | return (
19 |
22 | {children}
23 |
24 | );
25 | };
26 |
--------------------------------------------------------------------------------
/src/renderer/context/advanced/AdvancedThemeSongContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const AdvancedThemeSongsContext = createContext({});
4 |
5 | type AdvancedThemeSongsContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useAdvancedThemeSongs = () => {
10 | return useContext(AdvancedThemeSongsContext);
11 | };
12 |
13 | export const AdvancedThemeSongsContextProvider = ({
14 | children,
15 | }: AdvancedThemeSongsContextProviderProps) => {
16 | const [advancedThemeSongs, setAdvancedThemeSongs] = useState({
17 | openings: [],
18 | endings: [],
19 | });
20 |
21 | return (
22 |
25 | {children}
26 |
27 | );
28 | };
29 |
--------------------------------------------------------------------------------
/src/renderer/context/menu/MenuDataContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const ShowMenuContext = createContext({});
4 |
5 | type ShowMenuContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useShowMenu = () => {
10 | return useContext(ShowMenuContext);
11 | };
12 |
13 | export const ShowMenuContextProvider = ({
14 | children,
15 | }: ShowMenuContextProviderProps) => {
16 | const [ShowMenu, setShowMenu] = useState({
17 | mediaTitle: '',
18 | mediaDescription: '',
19 | });
20 |
21 | return (
22 |
23 | {children}
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/src/renderer/context/menu/PosXContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const PosXContext = createContext({});
4 |
5 | type PosXContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const usePosX = () => {
10 | return useContext(PosXContext);
11 | };
12 |
13 | export const PosXContextProvider = ({ children }: PosXContextProviderProps) => {
14 | const [PosX, setPosX] = useState(0);
15 |
16 | return (
17 |
18 | {children}
19 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/src/renderer/context/menu/PosYContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const PosYContext = createContext({});
4 |
5 | type PosYContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const usePosY = () => {
10 | return useContext(PosYContext);
11 | };
12 |
13 | export const PosYContextProvider = ({ children }: PosYContextProviderProps) => {
14 | const [PosY, setPosY] = useState(0);
15 |
16 | return (
17 |
18 | {children}
19 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/src/renderer/context/menu/ShowMenuContext.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode, createContext, useContext, useState } from 'react';
2 |
3 | export const ShowMenuContext = createContext({});
4 |
5 | type ShowMenuContextProviderProps = {
6 | children: ReactNode;
7 | };
8 |
9 | export const useShowMenu = () => {
10 | return useContext(ShowMenuContext);
11 | };
12 |
13 | export const ShowMenuContextProvider = ({
14 | children,
15 | }: ShowMenuContextProviderProps) => {
16 | const [ShowMenu, setShowMenu] = useState(false);
17 |
18 | return (
19 |
20 | {children}
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/src/renderer/context/services/AniListTokenContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type AniListTokenContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const AniListTokenContext = createContext({});
8 |
9 | export const useAniListToken = () => {
10 | return useContext(AniListTokenContext);
11 | };
12 |
13 | export const AniListTokenContextProvider = ({
14 | children,
15 | }: AniListTokenContextProviderProps) => {
16 | const [AniListToken, setAniListToken] = useState(
17 | window.electron.store.get('aniListToken'),
18 | );
19 |
20 | return (
21 |
22 | {children}
23 |
24 | );
25 | };
26 |
--------------------------------------------------------------------------------
/src/renderer/context/services/AniListUsernameContext.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useContext, ReactNode } from 'react';
2 |
3 | type AniListUsernameContextProviderProps = {
4 | children: ReactNode;
5 | };
6 |
7 | export const AniListUsernameContext = createContext({});
8 |
9 | export const useAniListUsername = () => {
10 | return useContext(AniListUsernameContext);
11 | };
12 |
13 | export const AniListUsernameContextProvider = ({
14 | children,
15 | }: AniListUsernameContextProviderProps) => {
16 | const [AniListUsername, setAniListUsername] = useState(
17 | window.electron.store.get('aniListUsername'),
18 | );
19 |
20 | return (
21 |
24 | {children}
25 |
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/src/renderer/context/services/MyAnimeListContext.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/context/services/MyAnimeListContext.tsx
--------------------------------------------------------------------------------
/src/renderer/context/services/MyAnimeListTokenContext.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/context/services/MyAnimeListTokenContext.tsx
--------------------------------------------------------------------------------
/src/renderer/extra/AniListAllTags.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/extra/AniListAllTags.json
--------------------------------------------------------------------------------
/src/renderer/extra/AniListGenres.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/extra/AniListGenres.json
--------------------------------------------------------------------------------
/src/renderer/functions/AnimeThemeSongs.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/functions/AnimeThemeSongs.ts
--------------------------------------------------------------------------------
/src/renderer/functions/LocationFunctions.tsx:
--------------------------------------------------------------------------------
1 | export function getLocationAbbreviation(location: string) {
2 | switch (location) {
3 | case 'animeWatching':
4 | return 'W';
5 | case 'mangaReading':
6 | return 'R';
7 | case 'lightNovelsReading':
8 | return 'R';
9 | case 'animeCompleted':
10 | return 'C';
11 | case 'mangaCompleted':
12 | return 'C';
13 | case 'lightNovelsCompleted':
14 | return 'C';
15 | case 'animeOnHold':
16 | return 'OH';
17 | case 'mangaOnHold':
18 | return 'OH';
19 | case 'lightNovelsOnHold':
20 | return 'OH';
21 | case 'animeDropped':
22 | return 'D';
23 | case 'mangaDropped':
24 | return 'D';
25 | case 'lightNovelsDropped':
26 | return 'D';
27 | case 'animePlanToWatch':
28 | return 'PTW';
29 | case 'mangaPlanToRead':
30 | return 'PTR';
31 | case 'lightNovelsPlanToRead':
32 | return 'PTR';
33 | default:
34 | return 'X';
35 | }
36 | }
37 |
38 | export function locationTest() {
39 | console.log('test');
40 | }
41 |
--------------------------------------------------------------------------------
/src/renderer/functions/NewsFunctions.tsx:
--------------------------------------------------------------------------------
1 | import { useQuery } from '@tanstack/react-query';
2 | import Axios from 'axios';
3 |
4 | const XMLParser = require('react-xml-parser');
5 |
6 | export const useNewsQuery = (newsCards: any) =>
7 | useQuery({
8 | queryKey: ['news'],
9 | queryFn: async () => {
10 | const RSS_URL = 'https://myanimelist.net/rss/news.xml';
11 | const myVar = await Axios.get(RSS_URL).then((res) => res.data);
12 | const jsonWithHeader = new XMLParser().parseFromString(myVar).children[0]
13 | .children;
14 | const json = jsonWithHeader.slice(3, jsonWithHeader.length);
15 | const result = await json.map((entry: any, index: any) => ({
16 | title: entry.children[1].value,
17 | text: entry.children[2].value,
18 | image: entry.children[3].value,
19 | date: entry.children[4].value,
20 | link: entry.children[5].value,
21 | key: index,
22 | }));
23 | console.log(json);
24 | console.log(result);
25 | newsCards.setNews(result);
26 |
27 | return result;
28 | },
29 | // initialData: [],
30 | });
31 |
32 | export const useNewsANNQuery = (newsCards: any) =>
33 | useQuery({
34 | queryKey: ['newsANN'],
35 | queryFn: async () => {
36 | const RSS_URL = 'https://www.animenewsnetwork.com';
37 | const myVar = await Axios.get(RSS_URL).then((res) => res.data);
38 | console.log(myVar);
39 | newsCards.setNewsAnn([]);
40 |
41 | return [];
42 | },
43 | // initialData: [],
44 | });
45 | export function newsTest() {
46 | console.log('news test');
47 | }
48 |
--------------------------------------------------------------------------------
/src/renderer/functions/StatusFunction.tsx:
--------------------------------------------------------------------------------
1 | export default function getStatusColor(status: string) {
2 | switch (status) {
3 | case 'NOT_YET_RELEASED':
4 | return 'plum';
5 | case 'RELEASING':
6 | return '#32CD32';
7 | case 'HIATUS':
8 | return '#FFD700';
9 | case 'FINISHED':
10 | return 'deepskyblue';
11 | case 'CANCELLED':
12 | return '#FF4500';
13 | default:
14 | return 'deepskyblue';
15 | }
16 | }
17 |
18 | export function getCategoryColor(filter: string) {
19 | if (filter !== '') {
20 | return 'warning';
21 | }
22 | return 'primary';
23 | }
24 |
--------------------------------------------------------------------------------
/src/renderer/functions/TestSettingsFunction.tsx:
--------------------------------------------------------------------------------
1 | import { useQuery } from '@tanstack/react-query';
2 | import Axios from 'axios';
3 | import { useAtom } from 'jotai';
4 | import { notificationOpenAltSettingsAtom } from 'renderer/store';
5 |
6 | export const useTestSettings = (
7 | myUserName: string,
8 | myToken: string,
9 | notifcationAltOpen: any,
10 | setNotificationAltOpen: any,
11 | notifcationOpen: any,
12 | setNotificationOpen: any,
13 | ) =>
14 | useQuery({
15 | queryKey: ['testSettings'],
16 | queryFn: async () => {
17 | const url = 'https://graphql.anilist.co';
18 |
19 | const headers = {
20 | headers: {
21 | Authorization: `Bearer ${myToken}`,
22 | 'Content-Type': 'application/json',
23 | Accept: 'application/json',
24 | },
25 | };
26 |
27 | // eslint-disable-next-line no-await-in-loop
28 | const myQuery = await Axios.post(
29 | url,
30 | {
31 | query: `
32 | query ($userName: String){
33 | MediaListCollection(userName:$userName, type:ANIME, sort:UPDATED_TIME_DESC){
34 | lists{
35 | name
36 | }
37 | }
38 | }
39 | `,
40 | variables: {
41 | userName: myUserName,
42 | },
43 | },
44 | headers,
45 | ).then((res) => res.data.data.MediaListCollection.lists);
46 | console.log(myQuery);
47 | return [];
48 | },
49 | onSuccess: () => {
50 | console.log('Success');
51 | setNotificationOpen(true);
52 | },
53 | onError: () => {
54 | console.log('Failed');
55 | setNotificationAltOpen(true);
56 | },
57 | enabled: false,
58 | });
59 |
60 | export const testSettings = () => {};
61 |
--------------------------------------------------------------------------------
/src/renderer/functions/UserFunctions.ts:
--------------------------------------------------------------------------------
1 | import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
2 | import Axios from 'axios';
3 |
4 | export const getUser = async (user: any) => {
5 | const url = 'https://graphql.anilist.co';
6 | const headers = {
7 | headers: {
8 | Authorization: `Bearer ${user.myToken}`,
9 | 'Content-Type': 'application/json',
10 | Accept: 'application/json',
11 | },
12 | };
13 | const myQuery = await Axios.post(
14 | url,
15 | {
16 | query: `
17 | query {
18 | Viewer {
19 | id
20 | name
21 | }
22 | }
23 | `,
24 | variables: {
25 | name: user.username,
26 | },
27 | },
28 | headers,
29 | ).then((res) => res.data.data);
30 |
31 | return [user, myQuery];
32 | };
33 |
34 | // not working for some reason
35 | export const changeUserAdult = async (user: any) => {
36 | const url = 'https://graphql.anilist.co';
37 | const headers = {
38 | headers: {
39 | Authorization: `Bearer ${user.myToken}`,
40 | 'Content-Type': 'application/json',
41 | Accept: 'application/json',
42 | },
43 | };
44 | const myQuery = await Axios.post(
45 | url,
46 | {
47 | query: `
48 | mutation ($name: String, $displayAdultContent: Boolean) {
49 | UpdateUser (name: $name, displayAdultContent: $displayAdultContent) {
50 | displayAdultContent
51 | }
52 | }
53 | `,
54 | variables: {
55 | name: user.username,
56 | displayAdultContent: user.adult,
57 | },
58 | },
59 | headers,
60 | ).then((res) => res.data.data);
61 |
62 | return [user, myQuery];
63 | };
64 |
65 | export const otherUser = () => {
66 | console.log('test');
67 | };
68 |
--------------------------------------------------------------------------------
/src/renderer/functions/api/queries/themeSongQuery.ts:
--------------------------------------------------------------------------------
1 | import { useQuery } from '@tanstack/react-query';
2 | import axios from 'axios';
3 |
4 | export const useThemeSongs = (myMediaAdvanced: any) => {
5 | useQuery({
6 | queryKey: ['themeSongs'],
7 | queryFn: async () => {
8 | const { data } = await axios.get(
9 | `https://api.jikan.moe/v4/anime/${myMediaAdvanced.advancedMedia.idMal}/themes`,
10 | );
11 | return data.data;
12 | },
13 | });
14 | };
15 |
16 | export const testThemeSongs = () => {
17 | console.log('test');
18 | };
19 |
--------------------------------------------------------------------------------
/src/renderer/functions/api/queue/QueueMutationsFunctions.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/functions/api/queue/QueueMutationsFunctions.tsx
--------------------------------------------------------------------------------
/src/renderer/functions/colors/colorFunctions.ts:
--------------------------------------------------------------------------------
1 | const getJoyChipColor = (
2 | filter: string,
3 | category: number,
4 | myCategory: number,
5 | ) => {
6 | if (filter === '') {
7 | return 'primary';
8 | }
9 | return 'neutral';
10 | };
11 |
12 | const getJoyTypographyColor = (
13 | filter: string,
14 | category: number,
15 | myCategory: number,
16 | ) => {
17 | return 'neutral';
18 | };
19 |
--------------------------------------------------------------------------------
/src/renderer/functions/data/generator/createMediaListEntryData.tsx:
--------------------------------------------------------------------------------
1 | export default function createMediaListEntryData(
2 | id: number,
3 | startDate: any,
4 | myStatus: string,
5 | mediaType: string,
6 | ) {
7 | return {
8 | completedAt: { year: null, month: null, day: null },
9 | mediaId: id,
10 | notes: null,
11 | progress: 0,
12 | progressVolumes: mediaType === 'ANIME' ? null : 0, // if anime, then null
13 | repeat: 0,
14 | score: 0,
15 | startedAt: startDate, // today's date
16 | status: myStatus, // where you want to put it
17 | private: false, // default is false
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/src/renderer/functions/edit/adjustedLocationStatus.tsx:
--------------------------------------------------------------------------------
1 | export default function getAdjustedLocationStatus(data: any) {
2 | if (data.startsWith('anime') || data.startsWith('manga')) {
3 | return data.substring(5);
4 | }
5 | if (data.startsWith('lightNovels')) {
6 | return data.substring(11);
7 | }
8 | return data;
9 | }
10 |
--------------------------------------------------------------------------------
/src/renderer/functions/edit/componentTypes.ts:
--------------------------------------------------------------------------------
1 | export const getComponentType = () => {
2 | console.log('hi');
3 | };
4 |
5 | export const getSnackbarType = (type: number) => {
6 | switch (type) {
7 | case 0:
8 | return 'info';
9 | case 1:
10 | return 'success';
11 | case 2:
12 | return 'error';
13 | case 3:
14 | return 'error';
15 | default:
16 | return 'info';
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/src/renderer/functions/edit/createMediaListEntry.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/functions/edit/createMediaListEntry.tsx
--------------------------------------------------------------------------------
/src/renderer/functions/edit/findMedia.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-plusplus */
2 | export default function findMediaIndex(data: any, title: string, id: number) {
3 | for (let i = 0; i < data.length(); i++) {
4 | if (data.titleRomaji === title && data.id === id) {
5 | return i;
6 | }
7 | }
8 | return -1;
9 | }
10 |
--------------------------------------------------------------------------------
/src/renderer/functions/edit/getAdjustedSiteLink.tsx:
--------------------------------------------------------------------------------
1 | export function getMalLink(malId: any, type: any) {
2 | if (malId != null) {
3 | switch (type) {
4 | case 'ANIME':
5 | return `https://myanimelist.net/anime/${malId}`;
6 | case 'MANGA':
7 | return `https://myanimelist.net/manga/${malId}`;
8 | default:
9 | return 'https://myanimelist.net';
10 | }
11 | }
12 | return 'https://myanimelist.net';
13 | }
14 |
15 | export function getAniListLink() {
16 | return null;
17 | }
18 |
--------------------------------------------------------------------------------
/src/renderer/functions/edit/getSortValues.ts:
--------------------------------------------------------------------------------
1 | export function getStatusValues(status: string) {
2 | switch (status) {
3 | case 'NOT_YET_RELEASED':
4 | return 0;
5 | case 'RELEASING':
6 | return 1;
7 | case 'HIATUS':
8 | return 1;
9 | case 'FINISHED':
10 | return 2;
11 | case 'CANCELLED':
12 | return 4;
13 | default:
14 | return 3;
15 | }
16 | }
17 |
18 | export function getTestSort() {
19 | return 0;
20 | }
21 |
--------------------------------------------------------------------------------
/src/renderer/functions/input/InputFunctions.tsx:
--------------------------------------------------------------------------------
1 | export const handleMinMax = (
2 | e: any,
3 | min: number,
4 | max: number,
5 | setValueFunction: any,
6 | ) => {
7 | if (e.target.value <= min) {
8 | setValueFunction(min);
9 | }
10 | if (e.target.value >= max) {
11 | setValueFunction(max);
12 | }
13 | if (e.target.value >= min && e.target.value <= max) {
14 | setValueFunction(e.target.value);
15 | }
16 | };
17 |
18 | export const getEpisodesOrChapters = (data: any) => {
19 | if (data.type === 'ANIME') {
20 | return data.episodes;
21 | }
22 | return data.chapters;
23 | };
24 |
25 | export const getZeroOrNumberValue = (number: any) => {
26 | if (number === null) {
27 | return 0;
28 | }
29 | return number;
30 | };
31 |
32 | export const handleNotNumbersOrBackSpace = (e: any) => {
33 | if ((e.keyCode >= 48 && e.keyCode <= 57) || e.keyCode === 9) {
34 | console.log('number');
35 | } else {
36 | e.preventDefault();
37 | }
38 | };
39 |
40 | export const getMaxValueEpisodesOrChapters = (
41 | type: string,
42 | episodes: any,
43 | chapters: any,
44 | ) => {
45 | if (type === 'ANIME') {
46 | return episodes;
47 | }
48 |
49 | return chapters;
50 | };
51 |
--------------------------------------------------------------------------------
/src/renderer/functions/input/LimitInputFunctions.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/functions/input/LimitInputFunctions.tsx
--------------------------------------------------------------------------------
/src/renderer/functions/sort/sortSeasonsFunctions.ts:
--------------------------------------------------------------------------------
1 | import {
2 | sortByAiringDateAscending,
3 | sortByAiringDateDescending,
4 | sortByAverageScoreAscending,
5 | sortByAverageScoreDescending,
6 | sortByEpisodesAscending,
7 | sortByEpisodesDescending,
8 | sortByPopularityAscending,
9 | sortByPopularityDescending,
10 | sortByStatusAscending,
11 | sortByStatusDescending,
12 | sortByTitleAscending,
13 | sortByTitleDescending,
14 | } from './sortFunctions';
15 |
16 | export default function sortSeasons(
17 | sort: number,
18 | titlePreference: string,
19 | data: any,
20 | ) {
21 | switch (sort) {
22 | case 0:
23 | return data;
24 | case 1:
25 | return [...data].sort(sortByAiringDateAscending);
26 | case 1.5:
27 | return [...data].sort(sortByAiringDateDescending);
28 | case 2:
29 | return [...data].sort(sortByPopularityDescending);
30 | case 2.5:
31 | return [...data].sort(sortByPopularityAscending);
32 | case 3:
33 | return [...data].sort(sortByAverageScoreDescending);
34 | case 3.5:
35 | return [...data].sort(sortByAverageScoreAscending);
36 | case 4:
37 | return [...data].sort(sortByStatusAscending);
38 | case 4.5:
39 | return [...data].sort(sortByStatusDescending);
40 | case 5:
41 | return [...data].sort((a, b) => {
42 | return sortByTitleDescending(a, b, titlePreference);
43 | });
44 | case 5.5:
45 | return [...data].sort((a, b) => {
46 | return sortByTitleAscending(a, b, titlePreference);
47 | });
48 | case 6:
49 | return [...data].sort(sortByEpisodesDescending);
50 | case 6.5:
51 | return [...data].sort(sortByEpisodesAscending);
52 | default:
53 | return data;
54 | }
55 | }
56 |
57 | /*
58 | Next Airing Time
59 | Title
60 | Episodes
61 | Score
62 | Status
63 | Popularity
64 | */
65 |
--------------------------------------------------------------------------------
/src/renderer/functions/view/InfoViewFunctions.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ReStartQ/anicour/40ee6feff289c88c6466640ffab2ceb62230909e/src/renderer/functions/view/InfoViewFunctions.tsx
--------------------------------------------------------------------------------
/src/renderer/functions/view/TitlePreferenceFunctions.tsx:
--------------------------------------------------------------------------------
1 | export function getTitle(titlePreference: any, media: any) {
2 | if (titlePreference === 'Romaji' && media.titleRomaji !== null) {
3 | return media.titleRomaji;
4 | }
5 | if (titlePreference === 'English' && media.titleEnglish !== null) {
6 | return media.titleEnglish;
7 | }
8 | if (titlePreference === 'Native' && media.titleNative !== null) {
9 | return media.titleNative;
10 | }
11 | if (media.titleEnglish === null || media.titleNative === null) {
12 | if (media.titleRomaji !== null) {
13 | return media.titleRomaji;
14 | }
15 | }
16 | return '?';
17 | }
18 |
19 | export function getOtherTitles(titlePreference: any, media: any) {
20 | switch (titlePreference) {
21 | case 'Romaji':
22 | return [media.titleEnglish, media.titleNative];
23 | case 'English':
24 | return [media.titleRomaji, media.titleNative];
25 | case 'Native':
26 | return [media.titleRomaji, media.titleEnglish];
27 | default:
28 | return [null, null];
29 | }
30 | }
31 |
32 | export function titlePreferenceTest() {
33 | console.log('test');
34 | }
35 |
--------------------------------------------------------------------------------
/src/renderer/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 | AniCour
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/renderer/index.tsx:
--------------------------------------------------------------------------------
1 | import { createRoot } from 'react-dom/client';
2 | import App from './App';
3 |
4 | const container = document.getElementById('root')!;
5 | const root = createRoot(container);
6 | root.render( );
7 |
8 | // calling IPC exposed from preload script
9 | window.electron.ipcRenderer.once('ipc-example', (arg) => {
10 | // eslint-disable-next-line no-console
11 | console.log(arg);
12 | });
13 |
14 | window.electron.ipcRenderer.on('settings', (arg) => {
15 | // eslint-disable-next-line no-console
16 | console.log(arg);
17 | });
18 |
19 | window.electron.ipcRenderer.sendMessage('ipc-example', ['ping']);
20 |
--------------------------------------------------------------------------------
/src/renderer/preload.d.ts:
--------------------------------------------------------------------------------
1 | import { ElectronHandler } from '../main/preload';
2 |
3 | declare global {
4 | // eslint-disable-next-line no-unused-vars
5 | interface Window {
6 | electron: ElectronHandler;
7 | }
8 | }
9 |
10 | export {};
11 |
--------------------------------------------------------------------------------
/src/renderer/styles/App.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * @NOTE: Prepend a `~` to css file paths that are in your node_modules
3 | * See https://github.com/webpack-contrib/sass-loader#imports
4 | */
5 |
6 | $label-color: #ffffff;
7 | $info-color: #e0e0e0;
8 | $my-light-blue: #87ceeb;
9 |
10 | * {
11 | margin: 0;
12 | padding: 0;
13 | box-sizing: border-box;
14 | font-family: Calibri;
15 | }
16 |
17 | /*scrollbar customization*/
18 | *::-webkit-scrollbar {
19 | width: 4px;
20 | }
21 |
22 | *::-webkit-scrollbar-track {
23 | background-color: #323232;
24 | }
25 |
26 | *::-webkit-scrollbar-thumb {
27 | background-color: deepskyblue;
28 | border-radius: 3px;
29 | }
30 |
31 | input[type='number']::-webkit-inner-spin-button,
32 | input[type='number']::-webkit-outer-spin-button {
33 | opacity: 0.9;
34 | }
35 |
36 | .title {
37 | color: #87ceeb;
38 | }
39 |
40 | .label-information {
41 | color: $label-color;
42 | }
43 |
44 | .information {
45 | color: $info-color;
46 | }
47 |
48 | .label-information-tooltip {
49 | color: $label-color;
50 | }
51 |
52 | .information-tooltip {
53 | font-weight: 500;
54 | }
55 |
56 | .description {
57 | color: $label-color;
58 | }
59 |
60 | /* Use !important to override Material-UI styles */
61 | .MuiNativeSelect-icon {
62 | display: none !important;
63 | }
64 |
65 | .Mui-disabled {
66 | border-color: #87beeb !important;
67 | }
68 |
--------------------------------------------------------------------------------
/src/renderer/styles/MediaAdvanced.scss:
--------------------------------------------------------------------------------
1 | // Nothing so far
2 | // This file is used to style the media advanced settings
3 |
--------------------------------------------------------------------------------
/src/renderer/styles/NewsAdvanced.scss:
--------------------------------------------------------------------------------
1 | $twitter-font-family: 'Helvetica Neue', Roboto, 'Segoe UI', Calibri, sans-serif;
2 | $news-advanced-link-color: #90caf9;
3 |
4 | #news-advanced img:not(.img-a-l) {
5 | display: block;
6 | margin-left: auto;
7 | margin-right: auto;
8 | max-width: 80%;
9 | }
10 |
11 | #news-advanced a:link {
12 | color: $news-advanced-link-color;
13 | }
14 |
15 | #news-advanced iframe {
16 | display: block;
17 | margin-left: auto;
18 | margin-right: auto;
19 | }
20 |
21 | blockquote.twitter-tweet {
22 | display: inline-block;
23 | font-family: $twitter-font-family;
24 | font-size: 12px;
25 | font-weight: bold;
26 | line-height: 16px;
27 | border-color: #eee #ddd #bbb;
28 | border-radius: 5px;
29 | border-style: solid;
30 | border-width: 1px;
31 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
32 | margin: 10px 5px;
33 | padding: 0 16px 16px 16px;
34 | max-width: 468px;
35 | }
36 |
37 | blockquote.twitter-tweet p {
38 | font-size: 16px;
39 | font-weight: normal;
40 | line-height: 20px;
41 | }
42 |
43 | blockquote.twitter-tweet a {
44 | color: inherit;
45 | font-weight: normal;
46 | text-decoration: none;
47 | outline: 0 none;
48 | }
49 |
50 | blockquote.twitter-tweet a:hover,
51 | blockquote.twitter-tweet a:focus {
52 | text-decoration: underline;
53 | }
54 |
--------------------------------------------------------------------------------
/src/renderer/styles/Trailer.scss:
--------------------------------------------------------------------------------
1 | // This file contains the styles for the Trailer component.
2 |
3 | // Just centering the iframe for the trailer
4 | iframe {
5 | display: block;
6 | margin-left: auto;
7 | margin-right: auto;
8 | margin: auto;
9 | }
10 |
--------------------------------------------------------------------------------
/src/renderer/styles/tables.scss:
--------------------------------------------------------------------------------
1 | $table-border-color: #4f4f4f;
2 | $table-container-background: #121212;
3 |
4 | table {
5 | border-collapse: collapse;
6 | border-spacing: 0;
7 | font-family: Calibri;
8 | table-layout: fixed;
9 | }
10 |
11 | thead {
12 | background: #1e3a5c; // #142F4C #0D223A #1A3556,
13 | }
14 |
15 | tbody tr:hover {
16 | background: #23272e !important; // #151617 original color
17 | }
18 |
19 | .selected-row:hover {
20 | background: #263447 !important;
21 | }
22 |
23 | tr {
24 | border-bottom: 1px solid $table-border-color;
25 | }
26 |
27 | th {
28 | padding: 4px;
29 | padding-left: 6px;
30 | text-align: start;
31 | border-right: 1px solid $table-border-color;
32 | font-size: 14px;
33 | font-weight: bold;
34 | }
35 |
36 | td {
37 | padding: 6px;
38 | }
39 |
40 | .container-table {
41 | border: 1px solid $table-border-color;
42 | margin-top: 10px;
43 | margin-bottom: 10px;
44 | padding-right: 4px;
45 | background: $table-container-background;
46 | }
47 |
48 | .media-table {
49 | text-align: center;
50 | }
51 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "incremental": true,
4 | "target": "es2022",
5 | "module": "commonjs",
6 | "lib": ["dom", "es2022"],
7 | "jsx": "react-jsx",
8 | "strict": true,
9 | "pretty": true,
10 | "sourceMap": true,
11 | "baseUrl": "./src",
12 | "moduleResolution": "node",
13 | "esModuleInterop": true,
14 | "allowSyntheticDefaultImports": true,
15 | "resolveJsonModule": true,
16 | "allowJs": true,
17 | "outDir": ".erb/dll"
18 | },
19 | "exclude": ["test", "release/build", "release/app/dist", ".erb/dll", "test2"]
20 | }
21 |
--------------------------------------------------------------------------------