summaryrefslogtreecommitdiffstats
path: root/ui/src/components
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2020-06-09 14:01:26 +0200
committerFelix Ableitner <me@nutomic.com>2020-06-09 14:01:26 +0200
commit0f1a8ec928a36d73490a41a778244578f39dd626 (patch)
treee55ec80acbb258197ce899cefe6e1b24e09ad2fb /ui/src/components
parent5c6601cb2a819d20b0f0d17f3575aff006a47fd2 (diff)
parenta13e9fe3959e07f901ba0647dfd7f749865a900d (diff)
Merge branch 'master' into federation
Diffstat (limited to 'ui/src/components')
-rw-r--r--ui/src/components/comment-node.tsx22
-rw-r--r--ui/src/components/login.tsx2
-rw-r--r--ui/src/components/main.tsx2
-rw-r--r--ui/src/components/post-form.tsx10
-rw-r--r--ui/src/components/post-listing.tsx2
-rw-r--r--ui/src/components/post.tsx12
-rw-r--r--ui/src/components/private-message-form.tsx55
-rw-r--r--ui/src/components/sidebar.tsx2
-rw-r--r--ui/src/components/sponsors.tsx29
-rw-r--r--ui/src/components/user.tsx4
10 files changed, 85 insertions, 55 deletions
diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx
index 9bc9c7bb..ca828a45 100644
--- a/ui/src/components/comment-node.tsx
+++ b/ui/src/components/comment-node.tsx
@@ -709,19 +709,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
get linkBtn() {
let node = this.props.node;
return (
- <button className="btn btn-link btn-animate">
- <Link
- class="text-muted"
- to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
- title={
- this.props.showContext ? i18n.t('show_context') : i18n.t('link')
- }
- >
- <svg class="icon icon-inline">
- <use xlinkHref="#icon-link"></use>
- </svg>
- </Link>
- </button>
+ <Link
+ class="btn btn-link btn-animate text-muted"
+ to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
+ title={this.props.showContext ? i18n.t('show_context') : i18n.t('link')}
+ >
+ <svg class="icon icon-inline">
+ <use xlinkHref="#icon-link"></use>
+ </svg>
+ </Link>
);
}
diff --git a/ui/src/components/login.tsx b/ui/src/components/login.tsx
index 581c4995..84014f68 100644
--- a/ui/src/components/login.tsx
+++ b/ui/src/components/login.tsx
@@ -187,6 +187,7 @@ export class Login extends Component<any, State> {
type="password"
id="register-password"
value={this.state.registerForm.password}
+ autoComplete="new-password"
onInput={linkEvent(this, this.handleRegisterPasswordChange)}
class="form-control"
required
@@ -206,6 +207,7 @@ export class Login extends Component<any, State> {
type="password"
id="register-verify-password"
value={this.state.registerForm.password_verify}
+ autoComplete="new-password"
onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
class="form-control"
required
diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx
index 9e0c3a59..c168feb0 100644
--- a/ui/src/components/main.tsx
+++ b/ui/src/components/main.tsx
@@ -288,9 +288,11 @@ export class Main extends Component<any, MainState> {
</ul>
)}
<ul class="my-2 list-inline">
+ {/*
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_online', { count: this.state.siteRes.online })}
</li>
+ */}
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: this.state.siteRes.site.number_of_users,
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index f04910be..22224c34 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -331,6 +331,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
value={this.state.postForm.community_id}
onInput={linkEvent(this, this.handlePostCommunityChange)}
>
+ <option>{i18n.t('select_a_community')}</option>
{this.state.communities.map(community => (
<option value={community.id}>
{community.local
@@ -362,7 +363,11 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
)}
<div class="form-group row">
<div class="col-sm-10">
- <button type="submit" class="btn btn-secondary mr-2">
+ <button
+ disabled={!this.state.postForm.community_id}
+ type="submit"
+ class="btn btn-secondary mr-2"
+ >
{this.state.loading ? (
<svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use>
@@ -568,7 +573,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
).id;
this.state.postForm.community_id = foundCommunityId;
} else {
- this.state.postForm.community_id = data.communities[0].id;
+ // By default, the null valued 'Select a Community'
}
this.setState(this.state);
@@ -578,6 +583,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
let selector = new Selectr(selectId, { nativeDropdown: false });
selector.on('selectr.select', option => {
this.state.postForm.community_id = Number(option.value);
+ this.setState(this.state);
});
}
} else if (res.op == UserOperation.CreatePost) {
diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx
index 6ebf5400..def42e3c 100644
--- a/ui/src/components/post-listing.tsx
+++ b/ui/src/components/post-listing.tsx
@@ -165,6 +165,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
if (isImage(post.url)) {
if (post.url.includes('pictshare')) {
return pictshareImage(post.url, thumbnail);
+ } else if (post.thumbnail_url) {
+ return pictshareImage(post.thumbnail_url, thumbnail);
} else {
return post.url;
}
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index cf9e7486..297d0465 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -40,7 +40,6 @@ import {
setupTippy,
} from '../utils';
import { PostListing } from './post-listing';
-import { PostListings } from './post-listings';
import { Sidebar } from './sidebar';
import { CommentForm } from './comment-form';
import { CommentNodes } from './comment-nodes';
@@ -183,14 +182,6 @@ export class Post extends Component<any, PostState> {
moderators={this.state.moderators}
admins={this.state.admins}
/>
- {this.state.crossPosts.length > 0 && (
- <>
- <div class="my-1 text-muted small font-weight-bold">
- {i18n.t('cross_posts')}
- </div>
- <PostListings showCommunity posts={this.state.crossPosts} />
- </>
- )}
<div className="mb-2" />
<CommentForm
postId={this.state.post.id}
@@ -466,6 +457,9 @@ export class Post extends Component<any, PostState> {
this.state.crossPosts = data.posts.filter(
p => p.id != Number(this.props.match.params.id)
);
+ if (this.state.crossPosts.length) {
+ this.state.post.duplicates = this.state.crossPosts;
+ }
this.setState(this.state);
} else if (res.op == UserOperation.TransferSite) {
let data = res.data as GetSiteResponse;
diff --git a/ui/src/components/private-message-form.tsx b/ui/src/components/private-message-form.tsx
index 586b867e..64e22d61 100644
--- a/ui/src/components/private-message-form.tsx
+++ b/ui/src/components/private-message-form.tsx
@@ -163,38 +163,12 @@ export class PrivateMessageForm extends Component<
)}
/>
)}
-
- <ul class="float-right list-inline mb-1 text-muted font-weight-bold">
- <li class="list-inline-item">
- <span
- onClick={linkEvent(this, this.handleShowDisclaimer)}
- class="pointer"
- data-tippy-content={i18n.t('disclaimer')}
- >
- <svg class={`icon icon-inline`}>
- <use xlinkHref="#icon-alert-triangle"></use>
- </svg>
- </span>
- </li>
- <li class="list-inline-item">
- <a
- href={markdownHelpUrl}
- target="_blank"
- class="text-muted"
- title={i18n.t('formatting_help')}
- >
- <svg class="icon icon-inline">
- <use xlinkHref="#icon-help-circle"></use>
- </svg>
- </a>
- </li>
- </ul>
</div>
</div>
{this.state.showDisclaimer && (
<div class="form-group row">
- <div class="col-sm-10">
+ <div class="offset-sm-2 col-sm-10">
<div class="alert alert-danger" role="alert">
<T i18nKey="private_message_disclaimer">
#
@@ -211,7 +185,7 @@ export class PrivateMessageForm extends Component<
</div>
)}
<div class="form-group row">
- <div class="col-sm-10">
+ <div class="offset-sm-2 col-sm-10">
<button type="submit" class="btn btn-secondary mr-2">
{this.state.loading ? (
<svg class="icon icon-spinner spin">
@@ -242,6 +216,31 @@ export class PrivateMessageForm extends Component<
{i18n.t('cancel')}
</button>
)}
+ <ul class="d-inline-block float-right list-inline mb-1 text-muted font-weight-bold">
+ <li class="list-inline-item">
+ <span
+ onClick={linkEvent(this, this.handleShowDisclaimer)}
+ class="pointer"
+ data-tippy-content={i18n.t('disclaimer')}
+ >
+ <svg class={`icon icon-inline`}>
+ <use xlinkHref="#icon-alert-triangle"></use>
+ </svg>
+ </span>
+ </li>
+ <li class="list-inline-item">
+ <a
+ href={markdownHelpUrl}
+ target="_blank"
+ class="text-muted"
+ title={i18n.t('formatting_help')}
+ >
+ <svg class="icon icon-inline">
+ <use xlinkHref="#icon-help-circle"></use>
+ </svg>
+ </a>
+ </li>
+ </ul>
</div>
</div>
</form>
diff --git a/ui/src/components/sidebar.tsx b/ui/src/components/sidebar.tsx
index dc2376d7..17ac64b9 100644
--- a/ui/src/components/sidebar.tsx
+++ b/ui/src/components/sidebar.tsx
@@ -173,9 +173,11 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
</form>
)}
<ul class="my-1 list-inline">
+ {/*
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_online', { count: this.props.online })}
</li>
+ */}
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_subscribers', {
count: community.number_of_subscribers,
diff --git a/ui/src/components/sponsors.tsx b/ui/src/components/sponsors.tsx
index cdd7bdad..35ec7635 100644
--- a/ui/src/components/sponsors.tsx
+++ b/ui/src/components/sponsors.tsx
@@ -4,14 +4,25 @@ import { i18n } from '../i18next';
import { T } from 'inferno-i18next';
import { repoUrl } from '../utils';
+interface SilverUser {
+ name: string;
+ link: string;
+}
+
let general = [
- 'alexx henry',
- 'Nathan J. Goode',
+ 'Ernest Wiśniewski',
+ 'HN',
+ 'Forrest Weghorst',
'Andre Vallestero',
'NotTooHighToHack',
];
let highlighted = ['Oskenso Kashi', 'Alex Benishek'];
-// let silver = [];
+let silver: Array<SilverUser> = [
+ {
+ name: 'Redjoker',
+ link: 'https://iww.org',
+ },
+];
// let gold = [];
// let latinum = [];
@@ -70,6 +81,18 @@ export class Sponsors extends Component<any, any> {
return (
<div class="container">
<h5>{i18n.t('sponsors')}</h5>
+ <p>{i18n.t('silver_sponsors')}</p>
+ <div class="row card-columns">
+ {silver.map(s => (
+ <div class="card col-12 col-md-2">
+ <div>
+ <a href={s.link} target="_blank">
+ 💎 {s.name}
+ </a>
+ </div>
+ </div>
+ ))}
+ </div>
<p>{i18n.t('general_sponsors')}</p>
<div class="row card-columns">
{highlighted.map(s => (
diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx
index 51b9582f..78807153 100644
--- a/ui/src/components/user.tsx
+++ b/ui/src/components/user.tsx
@@ -614,6 +614,7 @@ export class User extends Component<any, UserState> {
id="user-password"
class="form-control"
value={this.state.userSettingsForm.new_password}
+ autoComplete="new-password"
onInput={linkEvent(
this,
this.handleUserSettingsNewPasswordChange
@@ -634,6 +635,7 @@ export class User extends Component<any, UserState> {
id="user-verify-password"
class="form-control"
value={this.state.userSettingsForm.new_password_verify}
+ autoComplete="new-password"
onInput={linkEvent(
this,
this.handleUserSettingsNewPasswordVerifyChange
@@ -654,6 +656,7 @@ export class User extends Component<any, UserState> {
id="user-old-password"
class="form-control"
value={this.state.userSettingsForm.old_password}
+ autoComplete="new-password"
onInput={linkEvent(
this,
this.handleUserSettingsOldPasswordChange
@@ -750,6 +753,7 @@ export class User extends Component<any, UserState> {
<input
type="password"
value={this.state.deleteAccountForm.password}
+ autoComplete="new-password"
onInput={linkEvent(
this,
this.handleDeleteAccountPasswordChange