diff --git a/.github/workflows/latest_dev_commit.yml b/.github/workflows/latest_dev_commit.yml deleted file mode 100644 index 566ff2e5..00000000 --- a/.github/workflows/latest_dev_commit.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Latest Dev Commit - -on: - push: - branches: - - development - -jobs: - update-hash: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Get latest commit hash - id: vars - run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)" - - - name: Update latest_dev_commit.txt - run: echo "${{ steps.vars.outputs.commit_hash }}" > ./public/latest_dev_commit.txt - - - name: Commit and push - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add ./public/latest_dev_commit.txt - git commit -m "Update latest_dev_commit.txt with latest commit hash" - git push diff --git a/src/App.js b/src/App.js index a87a1681..e3f2e093 100755 --- a/src/App.js +++ b/src/App.js @@ -40,6 +40,7 @@ export default function App() { const location = useLocation(); const isHomeRoute = location.pathname === "/"; + const isElectron = window.electron && window.electron.isElectron; const [, setNewErrorMessage] = useError(); const [, setNewSuccessMessage] = useSuccess(); @@ -49,23 +50,20 @@ export default function App() { useEffect(() => { const successToast = localStorage.getItem("successToast"); const errorToast = localStorage.getItem("errorToast"); - const infoToast = localStorage.getItem("infoToast"); if (successToast) { setNewSuccessMessage(successToast); localStorage.removeItem("successToast"); } else if (errorToast) { setNewErrorMessage(errorToast); localStorage.removeItem("errorToast"); - } else if (infoToast) { - setNewInfoMessage(infoToast); - localStorage.removeItem("infoToast"); } else { return; } - }, [setNewErrorMessage, setNewSuccessMessage, setNewInfoMessage]); + }, [setNewErrorMessage, setNewSuccessMessage]); // check for new version + // TODO: delete this code and toast when v1.0.0 is released useEffect(() => { const fetchVersionInfo = async () => { try { @@ -73,18 +71,21 @@ export default function App() { const packageData = await packageRes.json(); if (packageJson.version !== packageData.version) { - const newVersionInfo = `New version available, plebchan v${packageData.version}. Refresh the page to update.`; - localStorage.setItem('infoToast', newVersionInfo); + const newVersionInfo = isElectron + ? `New version available, plebchan v${packageData.version}. You are using v${packageJson.version}. Download the latest version here: https://github.com/plebbit/plebchan/releases/latest` + : `New version available, plebchan v${packageData.version}. You are using v${packageJson.version}. Refresh to update.`; + setNewInfoMessage(newVersionInfo); } - // Check for commit hash if commitRef is defined if (commitRef.length > 0) { - const commitRes = await fetch('https://raw.githubusercontent.com/plebbit/plebchan/development/public/latest_dev_commit.txt', { cache: 'no-cache' }); - const latestCommit = await commitRes.text(); + const commitRes = await fetch('https://api.github.com/repos/plebbit/plebchan/commits?per_page=1&sha=development', { cache: 'no-cache' }); + const commitData = await commitRes.json(); - if (latestCommit.trim() !== commitRef.trim()) { - const newVersionInfo = `New dev version available, commit ${latestCommit}. Refresh the page to update.`; - localStorage.setItem('infoToast', newVersionInfo); + const latestCommitHash = commitData[0].sha; + + if (latestCommitHash.trim() !== commitRef.trim()) { + const newVersionInfo = `New dev version available, commit ${latestCommitHash.slice(0, 7)}. You are using commit ${commitRef.slice(0, 7)}. Refresh to update.`; + setNewInfoMessage(newVersionInfo); } } } catch (error) { @@ -93,7 +94,7 @@ export default function App() { }; fetchVersionInfo(); - }, [setNewInfoMessage]); + }, [setNewInfoMessage, isElectron]); // preload banners diff --git a/src/components/Embed.jsx b/src/components/Embed.jsx index c1d9ff55..67150c6e 100644 --- a/src/components/Embed.jsx +++ b/src/components/Embed.jsx @@ -53,7 +53,7 @@ const YoutubeEmbed = ({parsedUrl}) => { allow="accelerometer; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title={parsedUrl.href} - src={`https://www.youtube.com/embed/${youtubeId}`} + src={`https://www.youtube-nocookie.com/embed/${youtubeId}`} />; }; diff --git a/src/components/styled/views/Board.styled.jsx b/src/components/styled/views/Board.styled.jsx index d7b082f6..1f586bf1 100644 --- a/src/components/styled/views/Board.styled.jsx +++ b/src/components/styled/views/Board.styled.jsx @@ -1428,6 +1428,36 @@ export const TopBar = styled.div` } @media (min-width: 480px) { + .stats-all-container { + float: right; + margin-top: 3px; + margin-right: 30px; + overflow: hidden; + max-width: calc(100vw - 50vw); + } + + #stats-all { + display: inline-block; + max-width: calc(100vw - 50vw); + word-wrap: break-word; + white-space: nowrap; + text-overflow: ""; + overflow: hidden; + } + + .ellipsis-all { + white-space: nowrap; + } + + .ellipsis-all:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + #catalog-button-mobile { display: none; } @@ -1450,6 +1480,37 @@ export const TopBar = styled.div` @media (max-width: 480px) { line-height: 25px; + .stats-all-container { + height: 20px; + position: absolute; + margin-top: 13px; + text-align: left; + overflow: hidden; + width: 100vw; + } + + #stats-all { + display: inline-block; + max-width: 90vw; + word-wrap: break-word; + white-space: nowrap; + text-overflow: ""; + overflow: hidden; + } + + .ellipsis-all { + white-space: nowrap; + } + + .ellipsis-all:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + hr { display: none; } diff --git a/src/components/styled/views/Thread.styled.jsx b/src/components/styled/views/Thread.styled.jsx index ffd70322..c6810840 100644 --- a/src/components/styled/views/Thread.styled.jsx +++ b/src/components/styled/views/Thread.styled.jsx @@ -173,6 +173,36 @@ export const ReplyFormLink = styled.div` export const TopBar = styled.div` @media (min-width: 480px) { + .stats-all-catalog-container { + float: right; + margin-top: 3px; + margin-right: 30px; + overflow: hidden; + max-width: calc(100vw - 50vw); + } + + #stats-all { + display: inline-block; + max-width: calc(100vw - 50vw); + word-wrap: break-word; + white-space: nowrap; + text-overflow: ""; + overflow: hidden; + } + + .ellipsis-all { + white-space: nowrap; + } + + .ellipsis-all:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + #return-button-mobile { display: none; } @@ -193,6 +223,37 @@ export const TopBar = styled.div` } @media (max-width: 480px) { + .stats-all-catalog-container { + height: 25px; + position: absolute; + text-align: left; + overflow: hidden; + width: 100vw; + margin-top: -2px; + } + + #stats-all { + display: inline-block; + max-width: 90vw; + word-wrap: break-word; + white-space: nowrap; + text-overflow: ""; + overflow: hidden; + } + + .ellipsis-all { + white-space: nowrap; + } + + .ellipsis-all:after { + content: "\\2026"; + position: absolute; + -webkit-animation: ellipsis steps(4,end) 1200ms infinite; + animation: ellipsis steps(4,end) 1500ms infinite; + width: 0px; + overflow: hidden; + } + line-height: 30px; #return-button-desktop, #catalog-button-desktop, #bottom-button-desktop { diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index 5c18e161..d1d9ddd0 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -666,9 +666,12 @@ const All = () => { {subplebbits.state === "succeeded" ? ( null ) : ( -