diff options
author | Vitaly Takmazov | 2022-10-28 00:14:01 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:58 +0300 |
commit | 40d411e516efee5531404725b45ab89d97172ce8 (patch) | |
tree | d675e93fc52ef50a40343219e1b992867964d3bf /vnext/src | |
parent | 2146a98bd98b7e275a0ee7bc7a243981b597f34c (diff) |
Initial SSR
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/App.js | 49 | ||||
-rw-r--r-- | vnext/src/assets/av-96.png (renamed from vnext/src/ui/assets/av-96.png) | bin | 2018 -> 2018 bytes | |||
-rw-r--r-- | vnext/src/assets/logo.png (renamed from vnext/src/ui/assets/logo.png) | bin | 2447 -> 2447 bytes | |||
-rw-r--r-- | vnext/src/assets/logo@2x.png (renamed from vnext/src/ui/assets/logo@2x.png) | bin | 4822 -> 4822 bytes | |||
-rw-r--r-- | vnext/src/assets/matrix.jpg (renamed from vnext/src/ui/assets/matrix.jpg) | bin | 236176 -> 236176 bytes | |||
-rw-r--r-- | vnext/src/index.css | 568 | ||||
-rw-r--r-- | vnext/src/index.html | 30 | ||||
-rw-r--r-- | vnext/src/index.js | 11 | ||||
-rw-r--r-- | vnext/src/ui/Input.css | 2 | ||||
-rw-r--r-- | vnext/src/ui/Login.css | 4 | ||||
-rw-r--r-- | vnext/src/ui/UserInfo.js | 2 |
11 files changed, 539 insertions, 127 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index c3d4e5aa..b56e0300 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -24,7 +24,7 @@ const elClassHidden = 'header--hidden'; const elClassTop = 'content--top'; -export default function App() { +export default function App({ footer }) { let contentRef = useRef(null); const [cookie, setCookie] = useCookies(['hash']); @@ -37,7 +37,7 @@ export default function App() { let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`; window.history.replaceState({}, document.title, retpath); } - }, []); + }, [setCookie, footer]); /** * @type {import('./api').SecureUser} @@ -150,26 +150,35 @@ export default function App() { <> <Header visitor={visitor} className={scrollState.hidden ? elClassHidden : ''} /> <div id="content_wrapper"> - { - visitor.uid > 0 && + { <aside id="sidebar"> <div id="sidebar_wrapper"> - <Link to="/?show=my"> - <Icon name="ei-clock" size="s" /> - <span className="desktop">My feed</span> - </Link> - <Link to="/pm"> - <Icon name="ei-envelope" size="s" /> - <span className="desktop">Messages</span> - </Link> - <Link to="/?show=discuss"> - <Icon name="ei-bell" size="s" /> - <span className="desktop">Discussions</span> - </Link> - <Link to="/settings" rel="nofollow"> - <Icon name="ei-gear" size="s" /> - <span className="desktop">Settings</span> - </Link> + {visitor.uid > 0 && (<> + <Link to="/?show=my"> + <Icon name="ei-clock" size="s" /> + <span className="desktop">My feed</span> + </Link> + <Link to="/pm"> + <Icon name="ei-envelope" size="s" /> + <span className="desktop">Messages</span> + </Link> + <Link to="/?show=discuss"> + <Icon name="ei-bell" size="s" /> + <span className="desktop">Discussions</span> + </Link> + <Link to="/settings" rel="nofollow"> + <Icon name="ei-gear" size="s" /> + <span className="desktop">Settings</span> + </Link> + </>)} + <div id="footer" className="desktop"> + <div id="footer-left">juick.com © 2008-2022 + {footer && (<><br />Sponsors: <span dangerouslySetInnerHTML={{ __html: footer }}></span></>)}</div> + <div id="footer-right"> + · <Link href="/help/contacts" rel="nofollow">Contacts</Link> + · <Link href="/help/tos" rel="nofollow">TOS</Link> + </div> + </div> </div> </aside> } diff --git a/vnext/src/ui/assets/av-96.png b/vnext/src/assets/av-96.png Binary files differindex 911c0522..911c0522 100644 --- a/vnext/src/ui/assets/av-96.png +++ b/vnext/src/assets/av-96.png diff --git a/vnext/src/ui/assets/logo.png b/vnext/src/assets/logo.png Binary files differindex 4e0f6d56..4e0f6d56 100644 --- a/vnext/src/ui/assets/logo.png +++ b/vnext/src/assets/logo.png diff --git a/vnext/src/ui/assets/logo@2x.png b/vnext/src/assets/logo@2x.png Binary files differindex 6febeaf9..6febeaf9 100644 --- a/vnext/src/ui/assets/logo@2x.png +++ b/vnext/src/assets/logo@2x.png diff --git a/vnext/src/ui/assets/matrix.jpg b/vnext/src/assets/matrix.jpg Binary files differindex 745f1564..745f1564 100644 --- a/vnext/src/ui/assets/matrix.jpg +++ b/vnext/src/assets/matrix.jpg diff --git a/vnext/src/index.css b/vnext/src/index.css index 5a829f03..f3b337e6 100644 --- a/vnext/src/index.css +++ b/vnext/src/index.css @@ -11,6 +11,7 @@ --link-color: #3c77aa; --dimmed-link-color: #88958d; } + @media (prefers-color-scheme: dark) { :root { --main-background-color: #222; @@ -62,7 +63,19 @@ html, input, textarea, button { - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + Oxygen, + Ubuntu, + Cantarell, + "Fira Sans", + "Droid Sans", + "Helvetica Neue", + sans-serif; -webkit-font-smoothing: subpixel-antialiased; } @@ -110,25 +123,15 @@ hr { border: none; } -#app { - height: 100%; - width: 100%; -} - #header { background: var(--text-background-color); border-bottom: 1px solid var(--border-color); - transition: transform 0.2s; z-index: 10; position: fixed; width: 100%; top: 0; } -.header--hidden { - transform: translateY(-100%); -} - #header_wrapper, .footer_container { display: flex; @@ -144,6 +147,7 @@ hr { width: 100%; z-index: 10; } + #sidebar_wrapper { display: flex; flex-direction: row; @@ -155,22 +159,8 @@ hr { } #content { - margin-top: 0; - transition: margin-top 0.4s; - padding-bottom: 64px; -} - -.content--top { margin-top: 64px !important; -} - -#footer { - display: none; - background: var(--background-color); - border-top: 1px solid #ccc; - color: var(--text-color); - padding: 10px; - transition: margin-left 0.4s; + padding-bottom: 64px; } .desktop { @@ -187,7 +177,7 @@ hr { } #logo a { - background: url("./ui/assets/logo@2x.png") no-repeat; + background: url("./assets/logo@2x.png") no-repeat; background-size: cover; border: 0; display: block; @@ -200,13 +190,15 @@ hr { #ctitle { display: flex; + flex: 1; + white-space: nowrap; + overflow: hidden; } -#ctitle:first-child { - margin-right: 5px; - vertical-align: middle; - max-width: 48px; - max-height: 48px; +#ctitle a { + border-bottom: 2px solid transparent; + text-overflow: ellipsis; + overflow: hidden; } #global { @@ -215,8 +207,7 @@ hr { .l { display: flex; - flex-direction: row; - flex-wrap: wrap; + flex-flow: row wrap; } #global a, @@ -245,8 +236,17 @@ hr { cursor: pointer; } -#ctitle a { - padding: 2px 20px; +#sidebar .tags { + line-height: 140%; + padding: 12px; + text-align: justify; +} + +#sidebar .tags h4 { + color: #88958d; + display: block; + text-align: center; + font-weight: 400; } #global a, @@ -274,62 +274,480 @@ hr { border: 1px solid var(--border-color); outline: none !important; padding: 4px; - -webkit-appearance: none; + appearance: none; border-radius: 0; } -.lds-ripple { +.page { + background: var(--main-background-color); + border: 1px solid var(--border-color); + margin-bottom: 12px; + padding: 6px; + text-align: center; +} + +.page a { + color: var(--dimmed-link-color); +} + +.msg-cont .ir { + padding: 12px; +} + +.msg-cont .ir img { + max-width: 100%; + height: auto; +} + +.msg-cont > .h, +.msg-cont .msg-header { + padding: 12px; +} + +.msg-cont > .l { + border-top: 1px solid var(--border-color); + display: flex; + align-items: center; + justify-content: space-around; + background: var(--main-background-color); +} + +.msg-cont > .l a { + color: var(--dimmed-link-color); + margin-right: 15px; + font-size: small; +} + +.msg-tags { + color: var(--dimmed-link-color); + padding: 6px; +} + +.badge, +.msg-tags > a { + color: var(--dimmed-link-color); + display: inline-block; +} + +article .tags > a::before, +.msg-tags > a::before { + content: "#"; +} + +.msgthread { + margin-bottom: 0; +} + +.msg-cont { + background: var(--text-background-color); + border: 1px solid var(--border-color); + line-height: 140%; + margin-bottom: 12px; +} + +.reply-new .msg-cont { + border-right: 5px solid #0c0; +} + +.msg-ts { + font-size: small; + vertical-align: top; + word-wrap: break-word; + overflow-wrap: break-word; + word-break: break-word; +} + +.msg-ts, +.msg-ts > a { + color: var(--dimmed-link-color); +} + +.msg-txt { + margin: 0 0 12px; + padding: 12px; + word-wrap: break-word; + overflow-wrap: break-word; +} + +q::before, +q::after { + content: ""; +} + +q, +blockquote { + border-left: 3px solid #ccc; + color: #666; + display: block; + margin: 10px 0 10px 10px; + padding-left: 10px; + word-break: break-word; +} + +.msg-media { + text-align: center; +} + +.msg-media img { + max-width: 100%; + height: auto; +} + +.msg-links { + color: var(--dimmed-link-color); + font-size: small; + margin: 5px 0 0 0; + padding: 12px; +} + +.msg-comments { + color: var(--dimmed-link-color); + font-size: small; + margin-top: 10px; + overflow: hidden; + text-indent: 10px; +} + +.ta-wrapper { + border: 1px solid #ddd; + display: flex; + flex-grow: 1; +} + +.msg-comment { + display: flex; + margin-top: 10px; +} + +.msg-comment-hidden { + display: none; +} + +.msg-comment textarea { + border: 0; + flex-grow: 1; + outline: none !important; + padding: 4px; + resize: vertical; + vertical-align: top; +} + +.attach-photo { + cursor: pointer; +} + +.attach-photo-active { + color: green; +} + +.msg-comment input { + align-self: flex-start; + background: var(--background-color); + border: 1px solid var(--border-color); + color: #999; + margin: 0 0 0 6px; + position: sticky; + top: 70px; + vertical-align: top; + width: 50px; +} + +.msg-recomms { + color: var(--dimmed-link-color); + background: var(--main-background-color); + font-size: small; + margin-bottom: 10px; + padding: 6px; + border-bottom: 1px solid var(--border-color); + overflow: hidden; + text-indent: 10px; +} + +.msg-summary, +.msg-summary a { + color: var(--dimmed-link-color); + font-size: small; + padding: 12px; + text-align: right; +} + +.msg-bubble { + padding: 12px; display: inline-block; + background: var(--border-color); + color: #222; +} + +#replies .msg-txt, +#private-messages .msg-txt { + margin: 0; +} + +.title2 { + background: #fff; + margin: 20px 0; + padding: 10px 20px; +} + +.title2-right { + float: right; + line-height: 24px; +} + +#content .title2 h2 { + font-size: x-large; + margin: 0; +} + +.embedContainer { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + padding: 12px; position: relative; - width: 64px; - height: 64px; } -.lds-ripple div { - position: absolute; - border: 4px solid #ff339a; +.embedContainer > * { + box-sizing: border-box; + flex-grow: 1; + margin: 3px; + min-width: 49%; +} + +.embedContainer > .compact { + flex-grow: 0; +} + +.embedContainer .picture img { + display: block; +} + +.embedContainer img, +.embedContainer video { + max-width: 100%; + max-height: 80vh; +} + +.embedContainer > .audio, +.embedContainer > .youtube { + min-width: 90%; +} + +.embedContainer audio { + width: 100%; +} + +.embedContainer iframe { + overflow: hidden; + resize: vertical; + display: block; +} + +.msg-cont .nsfw .embedContainer img, +.msg-cont .nsfw .embedContainer video, +.msg-cont .nsfw .embedContainer iframe, +.msg-cont .nsfw .ir img { + opacity: 0.1; +} + +.msg-cont .nsfw .embedContainer img:hover, +.msg-cont .nsfw .embedContainer video:hover, +.msg-cont .nsfw .embedContainer iframe:hover, +.msg-cont .nsfw .ir img:hover { opacity: 1; - border-radius: 50%; - animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite; } -.lds-ripple div:nth-child(2) { - animation-delay: -0.5s; +.Button { + background: #fff; + border: 1px solid var(--border-color); + color: #888; + cursor: pointer; + display: inline-block; + margin: 5px; + padding: 4px 10px; } -@keyframes lds-ripple { - 0% { - top: 28px; - left: 28px; - width: 0; - height: 0; - opacity: 1; - } - 100% { - top: -1px; - left: -1px; - width: 58px; - height: 58px; - opacity: 0; +.Button:hover { + background: #f8f8f8; + border-bottom: 1px solid #ff339a; +} + +.Avatar { + display: flex; +} + +.msg-avatar { + max-height: 48px; + margin-right: 10px; + max-width: 48px; +} + +.msg-avatar img { + max-height: 48px; + vertical-align: top; + max-width: 48px; +} + +.info-avatar { + white-space: nowrap; +} + +.info-avatar img { + max-height: 36px; + max-width: 36px; + padding: 6px; + vertical-align: middle; +} + +.Chat_messages { + box-sizing: border-box; + padding: 0 20px; + overflow-y: auto; + height: 100%; + display: flex; + flex-direction: column-reverse; + width: 100%; +} + +#dialogt { + height: 100%; + left: 0; + position: fixed; + top: 0; + width: 100%; + z-index: 10; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(0, 0, 0, 30%); +} + +#dialogw { + z-index: 11; + max-width: 96%; + max-height: calc(100% - 100px); + background-color: #fff; +} + +#dialogw a { + display: block; +} + +#dialogw img { + max-height: 100%; + max-height: 90vh; + max-width: 100%; +} + +#dialog_header { + width: 100%; + height: 44px; + display: flex; + flex-direction: row-reverse; + align-items: center; +} + +.header_image { + background: rgba(0, 0, 0, 28%); +} + +#dialogc { + cursor: pointer; + color: #ccc; + padding-right: 6px; +} + +.dialoglogin { + background: #fff; + padding: 25px; + margin: 0 auto; +} + +@media (--viewport-desktop) { + .dialoglogin { + width: 300px; } } -.page { +.dialog-opened { + overflow: hidden; +} + +#signemail, +#signfb, +#signvk { + display: block; + line-height: 32px; + margin: 10px 0; + text-decoration: none; + width: 100%; +} + +#signvk { + margin-bottom: 30px; +} + +.dialoglogin form { + margin-top: 7px; +} + +.signinput, +.signsubmit { + border: 1px solid #ccc; + margin: 3px 0; + padding: 3px; +} + +.signsubmit { + width: 70px; +} + +.dialogshare { + background: #fff; + min-width: 300px; + overflow: auto; + padding: 20px; +} + +.dialogl { + background: #fff; + border: 1px solid #ddd; + margin: 3px 0 20px; + padding: 5px; +} + +.dialogshare li { + float: left; + margin: 5px 10px 0 0; +} + +.dialogshare a { + display: block; +} + +.dialogtxt { + background: #fff; + padding: 20px; +} + +#replies { background: var(--main-background-color); border: 1px solid var(--border-color); - margin-bottom: 12px; - padding: 6px; - text-align: center; + padding: 12px; } -.page a { - color: var(--dimmed-link-color); +.userinfo { + padding: 40px; + background-color: #fdfdfe; + margin: 12px; } @media (--viewport-mobile) { #content { margin-bottom: 12px; } + #sidebar { background: var(--text-background-color); } @@ -339,14 +757,17 @@ hr { .desktop { display: block; } + .mobile { display: none; } + #content { width: 100%; margin-bottom: 12px; padding-bottom: 12px; } + #sidebar { position: sticky; padding: 12px; @@ -355,31 +776,44 @@ hr { z-index: auto; overflow-y: auto; } + article, .page, .msg-cont { width: 640px; } + #sidebar_wrapper { width: 300px; overflow-y: auto; height: 100%; + position: fixed; flex-direction: column; + justify-content: start; } + #sidebar_wrapper a, .l a { border-right: 2px solid transparent; } + #sidebar_wrapper > a:hover { border-top: initial; border-right: 2px solid #ff339a; } + #header_wrapper, #content_wrapper { width: 1000px; margin: 0 auto; } + #content_wrapper { display: flex; } + #footer { + color: var(--dimmed-link-color); + padding: 10px; + font-size: 10pt; + } } diff --git a/vnext/src/index.html b/vnext/src/index.html index e69e1429..fa4b62a3 100644 --- a/vnext/src/index.html +++ b/vnext/src/index.html @@ -29,35 +29,7 @@ </head> <body> - <div id="app"> - <div id="header"> - <div id="header_wrapper"> - <div id="logo"><a href="/" /></div> - <nav id="global"> - <a href="/">Loading...</a> - </nav> - </div> - </div> - <div id="content"> - <noscript> - <article> - Javascript is required to use Juick from browser.<br /> Alternatively we have <a - href="mailto:juick@juick.com">maillist-like</a> - and <a href="xmpp:juick@juick.com">chat</a> interfaces. - </article> - </noscript> - </div> - <div id="footer"> - <div id="footer-right"> · - <a href="/help/contacts" rel="nofollow">Contacts</a> · - <a href="/help/tos" rel="nofollow">TOS</a> - </div> - <div id="footer-left">juick.com © 2008-2019 - <br /> - <!-- EXT_FOOTER --> - </div> - </div> - </div> + <div id="app"></div> </body> </html>
\ No newline at end of file diff --git a/vnext/src/index.js b/vnext/src/index.js index be2dfeb1..9f9fa4a3 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -1,7 +1,6 @@ import { StrictMode, lazy, Suspense } from 'react'; -import ReactDOM from 'react-dom'; -import { BrowserRouter } from "react-router-dom"; -import { CompatRouter } from "react-router-dom-v5-compat"; +import { hydrateRoot } from 'react-dom/client'; +import { BrowserRouter } from 'react-router-dom'; import { CookiesProvider } from 'react-cookie'; import './index.css'; @@ -21,13 +20,11 @@ const JuickApp = () => ( <Suspense fallback={LoadingView()}> <CookiesProvider> <BrowserRouter> - <CompatRouter> - <Juick /> - </CompatRouter> + <Juick /> </BrowserRouter> </CookiesProvider> </Suspense> </StrictMode> ); -ReactDOM.hydrate(<JuickApp />, document.getElementById('app')); +hydrateRoot(document.getElementById('app'), <JuickApp />); diff --git a/vnext/src/ui/Input.css b/vnext/src/ui/Input.css index dbe55eae..6a1e659f 100644 --- a/vnext/src/ui/Input.css +++ b/vnext/src/ui/Input.css @@ -3,6 +3,6 @@ border: 1px solid #ccc; outline: none !important; padding: 4px; - -webkit-appearance: none; + appearance: none; border-radius: 0; } diff --git a/vnext/src/ui/Login.css b/vnext/src/ui/Login.css index 30f107f5..46d16878 100644 --- a/vnext/src/ui/Login.css +++ b/vnext/src/ui/Login.css @@ -10,7 +10,7 @@ display: flex; align-items: center; justify-content: center; - background-color: rgba(0, 0, 0, 0.3); + background-color: rgba(0, 0, 0, 30%); } #dialogw { z-index: 11; @@ -34,7 +34,7 @@ align-items: center; } .header_image { - background: rgba(0, 0, 0, 0.28); + background: rgba(0, 0, 0, 28%); } #dialogc { cursor: pointer; diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js index 3890d0bc..5fe244ea 100644 --- a/vnext/src/ui/UserInfo.js +++ b/vnext/src/ui/UserInfo.js @@ -7,7 +7,7 @@ import Avatar from './Avatar'; import Icon from './Icon'; import SearchBox from './SearchBox'; // @ts-ignore -import defaultAvatar from './assets/av-96.png'; +import defaultAvatar from '../assets/av-96.png'; import './UserInfo.css'; |