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 ) : ( -
- {stateString} -
+
+ + {stateString} + + +
)}
diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx index 54b7d640..49640a77 100755 --- a/src/components/views/AllCatalog.jsx +++ b/src/components/views/AllCatalog.jsx @@ -864,7 +864,7 @@ const AllCatalog = () => { - + @@ -881,9 +881,12 @@ const AllCatalog = () => { {subplebbits.state === "succeeded" ? ( null ) : ( -
- {stateString} -
+
+ + {stateString} + + +
)}
diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index c35b0567..1e687ce6 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -1006,7 +1006,7 @@ const Board = () => { handleOptionClick("rules"); handleShareClick(selectedAddress, "rules"); }}> - Share thread + Share board {/* {isModerator ? ( <> @@ -1141,7 +1141,7 @@ const Board = () => {
  • { handleOptionClick("rules"); handleShareClick(selectedAddress, "rules"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change rules @@ -1297,7 +1297,7 @@ const Board = () => {
  • { handleOptionClick("description"); handleShareClick(selectedAddress, "description"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change description diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index eb45a500..eac1f5f7 100755 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -436,7 +436,7 @@ const CatalogPost = ({post}) => {
  • { handleOptionClick("rules"); handleShareClick(selectedAddress, "rules"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change rules @@ -580,7 +580,7 @@ const CatalogPost = ({post}) => {
  • { handleOptionClick("description"); handleShareClick(selectedAddress, "description"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change description diff --git a/src/components/views/Description.jsx b/src/components/views/Description.jsx index 8fefea1e..74b53c7c 100644 --- a/src/components/views/Description.jsx +++ b/src/components/views/Description.jsx @@ -370,7 +370,7 @@ const Description = () => {
  • { handleOptionClick("description"); handleShareClick(selectedAddress, "description"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change description diff --git a/src/components/views/Home.jsx b/src/components/views/Home.jsx index 99414c8a..4eccf9ee 100644 --- a/src/components/views/Home.jsx +++ b/src/components/views/Home.jsx @@ -1,6 +1,6 @@ import React, { Fragment, useEffect, useRef, useState } from 'react'; import { Helmet } from 'react-helmet-async'; -import { useAccount, useBufferedFeeds } from '@plebbit/plebbit-react-hooks'; +import { useAccount, useBufferedFeeds, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import { Link, useNavigate } from 'react-router-dom'; import { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from '../styled/views/Home.styled'; import BoardAvatar from '../BoardAvatar'; @@ -13,6 +13,23 @@ const {version} = packageJson; const commitRef = process?.env?.REACT_APP_COMMIT_REF ? ` ${process.env.REACT_APP_COMMIT_REF.slice(0, 7)}` : ''; +const SubplebbitTitle = ({address}) => { + const subplebbitAddress = address; + const subplebbit = useSubplebbit({subplebbitAddress}); + const title = subplebbit.title ?? null; + + return ( + <> + {title ? ( + {title} + ) : ( +   + )} + + ) +} + + const Home = () => { const { bodyStyle, setBodyStyle, @@ -168,7 +185,7 @@ const Home = () => { {defaultSubplebbits.map((subplebbit, index) => (
    - {subplebbit.title ? subplebbit.title :  } + {subplebbit.title ?? }
    { diff --git a/src/components/views/Rules.jsx b/src/components/views/Rules.jsx index cb478da7..b8526dcc 100644 --- a/src/components/views/Rules.jsx +++ b/src/components/views/Rules.jsx @@ -352,7 +352,7 @@ const Rules = () => {
  • { handleOptionClick("rules"); handleShareClick(selectedAddress, "rules"); - }}>Share thread
  • + }}>Share board {/* {isModerator ? ( <> change rules diff --git a/src/utils/handleShareClick.js b/src/utils/handleShareClick.js index 23d71bd2..19ab126c 100644 --- a/src/utils/handleShareClick.js +++ b/src/utils/handleShareClick.js @@ -3,9 +3,7 @@ function handleShareClick(selectedAddress, cid) { let shareLink = `${plebBzBaseURL}${selectedAddress}/`; - if (cid === "rules" || cid === "description") { - shareLink += cid; - } else { + if (cid !== "rules" && cid !== "description") { shareLink += `c/${cid}`; }