From: Jay Sitter Date: Sat, 17 Jun 2023 00:35:44 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/main' into feat/add-badges-common-component X-Git-Url: http://these/git/?a=commitdiff_plain;h=8bbb6c9652bbbfda1ca9cc41592c413549f16c75;hp=f8f1f49250dc26a2cb4b48bf707a684f0c75337a;p=lemmy-ui.git Merge remote-tracking branch 'origin/main' into feat/add-badges-common-component * origin/main: handle login failures correctly wrap login call in try/catch for error handling Remove extra div in post sidebar Add a class to the more button on a comment node Switch navbar classes to ids Adding a few more 0.18.0 API changes. (#1324) Use aside semantic HTML tag for sidebars Use article semantic HTML tag for posts/comments Use footer semantic HTML tag Adding codeowners. Add lemmy-site class for easier detection Add ID's and classes to sidebars Add clases and ID's to post form/listing Add classes to post and comment repy textareas Rename markdown-textarea ID's Add nav and footer ID's --- diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6df17d5..76916e6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @dessalines @SleeplessOne1917 +* @dessalines @SleeplessOne1917 @alectrocute diff --git a/package.json b/package.json index 2298d9e..b7c48c7 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "inferno-server": "^8.1.1", "isomorphic-cookie": "^1.2.4", "jwt-decode": "^3.1.2", - "lemmy-js-client": "0.17.2-rc.24", + "lemmy-js-client": "0.18.0-rc.1", "lodash": "^4.17.21", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", diff --git a/src/shared/components/app/app.tsx b/src/shared/components/app/app.tsx index 96857f3..c495548 100644 --- a/src/shared/components/app/app.tsx +++ b/src/shared/components/app/app.tsx @@ -25,7 +25,7 @@ export class App extends Component { return ( <> -
+
{siteView && ( )} diff --git a/src/shared/components/app/footer.tsx b/src/shared/components/app/footer.tsx index bd66165..aabe4ef 100644 --- a/src/shared/components/app/footer.tsx +++ b/src/shared/components/app/footer.tsx @@ -16,7 +16,7 @@ export class Footer extends Component { render() { return ( - + ); } } diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx index 6d310ee..c17837c 100644 --- a/src/shared/components/app/navbar.tsx +++ b/src/shared/components/app/navbar.tsx @@ -86,8 +86,12 @@ export class Navbar extends Component { const siteView = this.props.siteRes?.site_view; const person = UserService.Instance.myUserInfo?.local_user_view.person; return ( -
+ {showMoreChildren && (
{ focus allLanguages={this.props.allLanguages} siteLanguages={this.props.siteLanguages} + containerClass="comment-comment-container" onUpsertComment={this.props.onCreateComment} /> )} diff --git a/src/shared/components/common/badges.tsx b/src/shared/components/common/badges.tsx index 188d92c..4427895 100644 --- a/src/shared/components/common/badges.tsx +++ b/src/shared/components/common/badges.tsx @@ -9,7 +9,6 @@ import { numToSI } from "../../utils"; interface BadgesProps { counts: CommunityAggregates | SiteAggregates; - online: number; community_view?: CommunityView; } @@ -19,15 +18,9 @@ const isCommunityAggregates = ( return "subscribers" in counts; }; -export const Badges = ({ counts, community_view, online }: BadgesProps) => { +export const Badges = ({ counts, community_view }: BadgesProps) => { return (
    -
  • - {i18n.t("number_online", { - count: online, - formattedCount: numToSI(online), - })} -
  • {
  • {i18n.t("modlog")} diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index a4459ac..a3a9cbd 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -63,8 +63,9 @@ export class MarkdownTextArea extends Component< MarkdownTextAreaProps, MarkdownTextAreaState > { - private id = `comment-textarea-${randomStr()}`; - private formId = `comment-form-${randomStr()}`; + private id = `markdown-textarea-${randomStr()}`; + private formId = `markdown-form-${randomStr()}`; + private tribute: any; state: MarkdownTextAreaState = { diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 05fa55e..f2d7ad7 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -360,7 +360,6 @@ export class Community extends Component< community_view={res.community_view} moderators={res.moderators} admins={site_res.admins} - online={res.online} enableNsfw={enableNsfw(site_res)} editable allLanguages={site_res.all_languages} diff --git a/src/shared/components/community/sidebar.tsx b/src/shared/components/community/sidebar.tsx index 7023d13..711ab5e 100644 --- a/src/shared/components/community/sidebar.tsx +++ b/src/shared/components/community/sidebar.tsx @@ -39,7 +39,6 @@ interface SidebarProps { allLanguages: Language[]; siteLanguages: number[]; communityLanguages?: number[]; - online: number; enableNsfw?: boolean; showIcon?: boolean; editable?: boolean; @@ -132,41 +131,42 @@ export class Sidebar extends Component { const myUSerInfo = UserService.Instance.myUserInfo; const { name, actor_id } = this.props.community_view.community; return ( -
    -
    -
    - {this.communityTitle()} - {this.props.editable && this.adminButtons()} - {myUSerInfo && this.subscribe()} - {this.canPost && this.createPost()} - {myUSerInfo && this.blockCommunity()} - {!myUSerInfo && ( -
    - - ### - -
    - )} -
    -
    -
    -
    - {this.description()} - - {this.mods()} -
    +
    + ); } diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 1abb1ee..870eb76 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -361,7 +361,6 @@ export class Home extends Component { siteRes: { site_view: { counts, site }, admins, - online, }, showSubscribedMobile, showTrendingMobile, @@ -393,7 +392,6 @@ export class Home extends Component { site={site} admins={admins} counts={counts} - online={online} showLocal={showLocal(this.isoData)} /> )} @@ -417,41 +415,40 @@ export class Home extends Component { siteRes: { site_view: { counts, site }, admins, - online, }, } = this.state; return ( -
    -
    -
    -
    - {this.trendingCommunities()} - {canCreateCommunity(this.state.siteRes) && ( - - )} +
    +
    +
    + {this.trendingCommunities()} + {canCreateCommunity(this.state.siteRes) && ( -
    + )} +
    - - {this.hasFollows && ( -
    -
    {this.subscribedCommunities}
    -
    - )} -
    + + + {this.hasFollows && ( +
    +
    {this.subscribedCommunities}
    +
    + )}
    ); } diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 381c13b..841a3d2 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -172,7 +172,7 @@ export class Login extends Component { toast(i18n.t("enter_two_factor_code"), "info"); } - i.setState({ loginRes: { state: "empty" } }); + i.setState({ loginRes: { state: "failed", msg: loginRes.msg } }); break; } diff --git a/src/shared/components/home/site-form.tsx b/src/shared/components/home/site-form.tsx index 8b56808..4035c74 100644 --- a/src/shared/components/home/site-form.tsx +++ b/src/shared/components/home/site-form.tsx @@ -81,7 +81,6 @@ export class SiteForm extends Component { slur_filter_regex: ls.slur_filter_regex, actor_name_max_length: ls.actor_name_max_length, federation_enabled: ls.federation_enabled, - federation_debug: ls.federation_debug, federation_worker_count: ls.federation_worker_count, captcha_enabled: ls.captcha_enabled, captcha_difficulty: ls.captcha_difficulty, diff --git a/src/shared/components/home/site-sidebar.tsx b/src/shared/components/home/site-sidebar.tsx index 5f32e59..66a48ca 100644 --- a/src/shared/components/home/site-sidebar.tsx +++ b/src/shared/components/home/site-sidebar.tsx @@ -12,7 +12,6 @@ interface SiteSidebarProps { showLocal: boolean; counts?: SiteAggregates; admins?: PersonView[]; - online?: number; } interface SiteSidebarState { @@ -30,7 +29,7 @@ export class SiteSidebar extends Component { render() { return ( -
    +
    {this.siteName()}
    @@ -42,7 +41,7 @@ export class SiteSidebar extends Component { )}
    -
    + ); } @@ -72,9 +71,7 @@ export class SiteSidebar extends Component {
    {site.description &&
    {site.description}
    } {site.sidebar && this.siteSidebar(site.sidebar)} - {this.props.counts && ( - - )} + {this.props.counts && } {this.props.admins && this.admins(this.props.admins)}
    ); diff --git a/src/shared/components/post/create-post.tsx b/src/shared/components/post/create-post.tsx index c759791..baa7b45 100644 --- a/src/shared/components/post/create-post.tsx +++ b/src/shared/components/post/create-post.tsx @@ -166,7 +166,10 @@ export class CreatePost extends Component< ) : (
    -
    +
    {i18n.t("create_post")}
    { body() { const body = this.postView.post.body; return body ? ( -
    +
    {this.state.viewSource ? (
    {body}
    ) : (
    )} -
    +
    ) : ( <> ); @@ -464,7 +464,7 @@ export class PostListing extends Component { {showScores() ? (
    {numToSI(this.postView.counts.score)} @@ -1398,7 +1398,7 @@ export class PostListing extends Component { <> {/* The mobile view*/}
    -
    +
    {this.createdLine()} @@ -1413,14 +1413,14 @@ export class PostListing extends Component { {this.duplicatesLine()} {this.removeAndBanDialogs()}
    -
    +
    {/* The larger view*/}
    -
    +
    {!this.props.viewOnly && this.voteBar()} -
    +
    {this.thumbnail()}
    @@ -1435,7 +1435,7 @@ export class PostListing extends Component {
    -
    +
    ); diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index 5136580..25fd1b3 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -384,6 +384,7 @@ export class Post extends Component { disabled={res.post_view.post.locked} allLanguages={this.state.siteRes.all_languages} siteLanguages={this.state.siteRes.discussion_languages} + containerClass="post-comment-container" onUpsertComment={this.handleCreateComment} finished={this.state.finished.get(0)} /> @@ -547,25 +548,22 @@ export class Post extends Component { const res = this.state.postRes; if (res.state === "success") { return ( -
    - -
    + ); } } diff --git a/yarn.lock b/yarn.lock index f783f07..7cd6447 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5615,10 +5615,10 @@ leac@^0.6.0: resolved "https://registry.yarnpkg.com/leac/-/leac-0.6.0.tgz#dcf136e382e666bd2475f44a1096061b70dc0912" integrity sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg== -lemmy-js-client@0.17.2-rc.24: - version "0.17.2-rc.24" - resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.2-rc.24.tgz#3b09233a6d89286e559be2e840d81c0c549562ad" - integrity sha512-aSHz7UTcwnwnNd9poY8tEXP7RA9ieZm9MAfSljcbCNU5ds9CASXYNodmraUVJiqCmT4HWnj7IeVmBC9r7nTHnw== +lemmy-js-client@0.18.0-rc.1: + version "0.18.0-rc.1" + resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.18.0-rc.1.tgz#fd0c88810572d90413696011ebaed19e3b8162d8" + integrity sha512-lQe443Nr5UCSoY+IxmT7mBe0IRF6EAZ/4PJSRoPSL+U8A+egMMBPbuxnisHzLsC+eDOWRUIgOqZlwlaRnbmuig== dependencies: cross-fetch "^3.1.5" form-data "^4.0.0"