From 1e3d3171c0c14fd741808b059e81ff11c29df707 Mon Sep 17 00:00:00 2001 From: KevinX8 Date: Fri, 18 Feb 2022 20:41:31 +0000 Subject: [PATCH 1/3] Test grabbing directly from github --- src/App.js | 12 ++++---- src/components/layout/Header.js | 7 ++--- src/components/sections/ChangeLogs.js | 42 ++++++++++++++++++++------- src/components/sections/Hero.js | 8 ++--- src/components/sections/HeroPc.js | 4 --- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/App.js b/src/App.js index 5b07c73..a3751b1 100644 --- a/src/App.js +++ b/src/App.js @@ -24,7 +24,7 @@ const tagManagerArgs = { gtmId: "GTM-MXQ4LWV", }; -export const ChangeLogContext = createContext(); +export const ManagerContext = createContext(); export const ShowBraveContext = createContext(); // Change this to show BRAVE across website @@ -42,17 +42,17 @@ const App = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [location]); - const [changeLogs, setChangeLogs] = useState({}); + const [managerData, setManager] = useState({}); useEffect(() => { - fetch(process.env.REACT_APP_VANCED_LATEST_API_URL) + fetch("https://api.github.com/repos/YTVanced/VancedManager/releases/latest") .then(res => res.json()) - .then(data => setChangeLogs(data)); + .then(data => setManager(data)); }, []); return ( - + ( @@ -84,7 +84,7 @@ const App = () => { )} /> - + ); }; diff --git a/src/components/layout/Header.js b/src/components/layout/Header.js index 971332d..4fdca0e 100644 --- a/src/components/layout/Header.js +++ b/src/components/layout/Header.js @@ -3,8 +3,7 @@ import PropTypes from "prop-types"; import classNames from "classnames"; import { Link } from "react-router-dom"; import Logo from "./partials/Logo"; -import { ChangeLogContext } from "../../App"; -import { Link as LinkScroll } from "react-scroll"; +import { ManagerContext } from "../../App"; const propTypes = { navPosition: PropTypes.string, @@ -80,9 +79,7 @@ const Header = ({ className, ); - const ytVanced = useContext(ChangeLogContext)?.vanced; - const musicVanced = useContext(ChangeLogContext)?.music; - const vancedManagerAPKUrl = useContext(ChangeLogContext)?.manager?.url; + const vancedManagerAPKUrl = useContext(ManagerContext)?.assets[0]?.browser_download_url; return (
diff --git a/src/components/sections/ChangeLogs.js b/src/components/sections/ChangeLogs.js index 62dc377..ace0f26 100644 --- a/src/components/sections/ChangeLogs.js +++ b/src/components/sections/ChangeLogs.js @@ -1,8 +1,8 @@ -import React, { useContext } from "react"; +import React, { useContext, useEffect, useState } from "react"; import classNames from "classnames"; import { SectionProps } from "../../utils/SectionProps"; -import { ChangeLogContext } from "../../App"; +import { ManagerContext } from "../../App"; const propTypes = { ...SectionProps.types, @@ -37,13 +37,35 @@ const ChangeLogs = ({ bottomDivider && "has-bottom-divider", ); - const changeLogs = useContext(ChangeLogContext); + const [vancedData, setVanced] = useState({}); + const [musicData, setMusic] = useState({}); + const [microgData, setMicrog] = useState({}); + + useEffect(() => { + fetch("https://api.github.com/repos/YTVanced/Vanced/releases/latest") + .then(res => res.json()) + .then(data => setVanced(data)); + }, []); + + useEffect(() => { + fetch("https://api.github.com/repos/YTVanced/VancedMusic/releases/latest") + .then(res => res.json()) + .then(data => setMusic(data)); + }, []); + + useEffect(() => { + fetch("https://api.github.com/repos/YTVanced/VancedMicroG/releases/latest") + .then(res => res.json()) + .then(data => setMicrog(data)); + }, []); + + const managerData = useContext(ManagerContext); const changeLogsLoopData = [ - { name: "Vanced Manager", data: changeLogs?.manager }, - { name: "MicroG", data: changeLogs?.microg }, - { name: "YouTube™ Music Vanced", data: changeLogs?.music }, - { name: "YouTube™ Vanced", data: changeLogs?.vanced }, + { name: "Vanced Manager", data: managerData }, + { name: "MicroG", data: vancedData }, + { name: "YouTube™ Music Vanced", data: musicData }, + { name: "YouTube™ Vanced", data: microgData }, ]; return ( @@ -68,18 +90,18 @@ const ChangeLogs = ({

{data.name}{" "} - + - (v{data?.data?.version}) + (v{data?.data?.tag_name.split('-')[0]})

Changelog:

    - {data?.data?.changelog.split("- ").map(point => { + {data?.data?.body.split("- ").map(point => { if (point) { return
  • {point}
  • ; } diff --git a/src/components/sections/Hero.js b/src/components/sections/Hero.js index 3add306..1028216 100644 --- a/src/components/sections/Hero.js +++ b/src/components/sections/Hero.js @@ -8,7 +8,7 @@ import Button from "../elements/Button"; import getRandomQuotes from "../../utils/getRandomQuotes"; import Image from "../elements/Image"; import DownloadImg from "./../../assets/images/download.svg"; -import { ChangeLogContext, ShowBraveContext } from "../../App"; +import { ManagerContext, ShowBraveContext } from "../../App"; import { SiBrave, SiAdguard } from "react-icons/si"; import { ADGUARD, BRAVE } from "../../constants/links"; @@ -58,7 +58,7 @@ const Hero = ({ bottomDivider && "has-bottom-divider", ); - const vancedManager = useContext(ChangeLogContext)?.manager; + const vancedManager = useContext(ManagerContext); const showBrave = useContext(ShowBraveContext); return ( @@ -85,9 +85,9 @@ const Hero = ({ tag="a" color="primary" wideMobile - href={vancedManager?.url} + href={vancedManager?.assets[0]?.browser_download_url} > - Vanced Manager (v{vancedManager?.version}) + Vanced Manager ({vancedManager?.tag_name.split('-')[0]}) Features tile icon 01
    From 40db7838d405c19db2d290de0c497cdc46ca220b Mon Sep 17 00:00:00 2001 From: KevinX8 Date: Fri, 18 Feb 2022 20:48:33 +0000 Subject: [PATCH 2/3] Fix build error --- src/components/layout/partials/FooterNav.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/layout/partials/FooterNav.js b/src/components/layout/partials/FooterNav.js index 6a61ded..32014de 100644 --- a/src/components/layout/partials/FooterNav.js +++ b/src/components/layout/partials/FooterNav.js @@ -1,14 +1,14 @@ import React, { useContext } from "react"; import classNames from "classnames"; import { Link } from "react-router-dom"; -import { ChangeLogContext, ShowBraveContext } from "../../../App"; +import { ManagerContext, ShowBraveContext } from "../../../App"; import { SiBrave, SiAdguard } from "react-icons/si"; import { ADGUARD, BRAVE } from "../../../constants/links"; const FooterNav = ({ className, ...props }) => { const classes = classNames("footer-nav", className); - const vancedManagerAPKUrl = useContext(ChangeLogContext)?.manager?.url; + const vancedManagerAPKUrl = useContext(ManagerContext)?.assets[0]?.browser_download_url; const showBrave = useContext(ShowBraveContext); return ( From aff732e4a07992ffd79980432b0ef15346a613c6 Mon Sep 17 00:00:00 2001 From: KevinX8 Date: Fri, 18 Feb 2022 22:21:10 +0000 Subject: [PATCH 3/3] Fix rendering issue --- src/assets/scss/core/abstracts/_mixins.scss | 4 ++++ src/components/layout/Header.js | 2 +- src/components/layout/partials/FooterNav.js | 2 +- src/components/sections/ChangeLogs.js | 9 +++++---- src/components/sections/Hero.js | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/assets/scss/core/abstracts/_mixins.scss b/src/assets/scss/core/abstracts/_mixins.scss index 422a7ba..2340edf 100644 --- a/src/assets/scss/core/abstracts/_mixins.scss +++ b/src/assets/scss/core/abstracts/_mixins.scss @@ -1,6 +1,10 @@ // Font Family @mixin font-family($elem) { + @if (type-of($elem) == string) { font-family: unquote(get-font-family($elem)); + } @else { + font-family: initial; + } } // Font-size + Line-height + Kerning diff --git a/src/components/layout/Header.js b/src/components/layout/Header.js index 4fdca0e..f2c7bb4 100644 --- a/src/components/layout/Header.js +++ b/src/components/layout/Header.js @@ -79,7 +79,7 @@ const Header = ({ className, ); - const vancedManagerAPKUrl = useContext(ManagerContext)?.assets[0]?.browser_download_url; + const vancedManagerAPKUrl = "https://github.com/YTVanced/VancedManager/releases/latest/download/manager.apk"; return (
    diff --git a/src/components/layout/partials/FooterNav.js b/src/components/layout/partials/FooterNav.js index 32014de..65b087b 100644 --- a/src/components/layout/partials/FooterNav.js +++ b/src/components/layout/partials/FooterNav.js @@ -8,7 +8,7 @@ import { ADGUARD, BRAVE } from "../../../constants/links"; const FooterNav = ({ className, ...props }) => { const classes = classNames("footer-nav", className); - const vancedManagerAPKUrl = useContext(ManagerContext)?.assets[0]?.browser_download_url; + const vancedManagerAPKUrl = "https://github.com/YTVanced/VancedManager/releases/latest/download/manager.apk"; const showBrave = useContext(ShowBraveContext); return ( diff --git a/src/components/sections/ChangeLogs.js b/src/components/sections/ChangeLogs.js index ace0f26..23ffe35 100644 --- a/src/components/sections/ChangeLogs.js +++ b/src/components/sections/ChangeLogs.js @@ -63,9 +63,9 @@ const ChangeLogs = ({ const changeLogsLoopData = [ { name: "Vanced Manager", data: managerData }, - { name: "MicroG", data: vancedData }, + { name: "MicroG", data: microgData }, { name: "YouTube™ Music Vanced", data: musicData }, - { name: "YouTube™ Vanced", data: microgData }, + { name: "YouTube™ Vanced", data: vancedData }, ]; return ( @@ -95,16 +95,17 @@ const ChangeLogs = ({ className="m-0 mb-32 reveal-from-bottom text-sm text-color-secondary" data-reveal-delay="400" > - (v{data?.data?.tag_name.split('-')[0]}) + ({data?.data?.tag_name?.split('-')[0]})

    Changelog:

      - {data?.data?.body.split("- ").map(point => { + {data?.data?.body?.split("- ").map(point => { if (point) { return
    • {point}
    • ; } + return point; })}

    diff --git a/src/components/sections/Hero.js b/src/components/sections/Hero.js index 1028216..d1f703e 100644 --- a/src/components/sections/Hero.js +++ b/src/components/sections/Hero.js @@ -85,9 +85,9 @@ const Hero = ({ tag="a" color="primary" wideMobile - href={vancedManager?.assets[0]?.browser_download_url} + href="https://github.com/YTVanced/VancedManager/releases/latest/download/manager.apk" > - Vanced Manager ({vancedManager?.tag_name.split('-')[0]}) + Vanced Manager ({vancedManager?.tag_name?.split('-')[0]})