mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
@@ -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
|
||||
+15
-14
@@ -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
|
||||
|
||||
@@ -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}`}
|
||||
/>;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -666,9 +666,12 @@ const All = () => {
|
||||
{subplebbits.state === "succeeded" ? (
|
||||
null
|
||||
) : (
|
||||
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
||||
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
||||
</div>
|
||||
<div className="stats-all-container">
|
||||
<span id="stats-all">
|
||||
{stateString}
|
||||
</span>
|
||||
<span className={stateString ? "ellipsis-all" : ""} />
|
||||
</div>
|
||||
)}
|
||||
<div id="catalog-button-mobile">
|
||||
<span className="btn-wrap">
|
||||
|
||||
@@ -864,7 +864,7 @@ const AllCatalog = () => {
|
||||
<option value="Yotsuba-B">Yotsuba B</option>
|
||||
<option value="Futaba">Futaba</option>
|
||||
<option value="Burichan">Burichan</option>
|
||||
<option value="Tomorrow">Tomorrow</option>
|
||||
<option value="Tomùorrow">Tomorrow</option>
|
||||
<option value="Photon">Photon</option>
|
||||
</select>
|
||||
</span>
|
||||
@@ -881,9 +881,12 @@ const AllCatalog = () => {
|
||||
{subplebbits.state === "succeeded" ? (
|
||||
null
|
||||
) : (
|
||||
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
||||
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
||||
</div>
|
||||
<div className="stats-all-catalog-container">
|
||||
<span id="stats-all">
|
||||
{stateString}
|
||||
</span>
|
||||
<span className={stateString ? "ellipsis-all" : ""} />
|
||||
</div>
|
||||
)}
|
||||
<hr />
|
||||
</TopBar>
|
||||
|
||||
@@ -1006,7 +1006,7 @@ const Board = () => {
|
||||
handleOptionClick("rules");
|
||||
handleShareClick(selectedAddress, "rules");
|
||||
}}>
|
||||
Share thread
|
||||
Share board
|
||||
</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
@@ -1141,7 +1141,7 @@ const Board = () => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("rules");
|
||||
handleShareClick(selectedAddress, "rules");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change rules
|
||||
@@ -1297,7 +1297,7 @@ const Board = () => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("description");
|
||||
handleShareClick(selectedAddress, "description");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change description
|
||||
|
||||
@@ -436,7 +436,7 @@ const CatalogPost = ({post}) => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("rules");
|
||||
handleShareClick(selectedAddress, "rules");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change rules
|
||||
@@ -580,7 +580,7 @@ const CatalogPost = ({post}) => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("description");
|
||||
handleShareClick(selectedAddress, "description");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change description
|
||||
|
||||
@@ -370,7 +370,7 @@ const Description = () => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("description");
|
||||
handleShareClick(selectedAddress, "description");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change description
|
||||
|
||||
@@ -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 ? (
|
||||
<span>{title}</span>
|
||||
) : (
|
||||
<span style={{userSelect: "none"}}> </span>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
const Home = () => {
|
||||
const {
|
||||
bodyStyle, setBodyStyle,
|
||||
@@ -168,7 +185,7 @@ const Home = () => {
|
||||
{defaultSubplebbits.map((subplebbit, index) => (
|
||||
<div className="board" key={`board-${index}`}>
|
||||
<div className="board-title" key="board-title">
|
||||
{subplebbit.title ? subplebbit.title : <span style={{userSelect: "none"}}> </span>}
|
||||
{subplebbit.title ?? <SubplebbitTitle address={subplebbit.address} />}
|
||||
</div>
|
||||
<div className="board-avatar-container" key="board-avatar-container">
|
||||
<Link to={`/p/${subplebbit.address}`} key="link" onClick={() => {
|
||||
|
||||
@@ -352,7 +352,7 @@ const Rules = () => {
|
||||
<li onClick={() => {
|
||||
handleOptionClick("rules");
|
||||
handleShareClick(selectedAddress, "rules");
|
||||
}}>Share thread</li>
|
||||
}}>Share board</li>
|
||||
{/* {isModerator ? (
|
||||
<>
|
||||
change rules
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user