From 2f01935cba8b1ac624e4c1f39b6db1b0b96e9323 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 9 May 2018 23:29:14 +0200 Subject: Adapt account fields rendering code in the WebUI to match upstream --- .../glitch/features/account/components/header.js | 42 +++++++++------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'app/javascript/flavours/glitch/features/account/components/header.js') diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 7a0a2dfa9..044155cd8 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -102,35 +102,25 @@ export default class Header extends ImmutablePureComponent {
{fields.size > 0 && ( - - - {fields.map((pair, i) => ( - - - ))} - -
- -
+
+ {fields.map((pair, i) => ( +
+
+
+
+ ))} +
)} {fields.size == 0 && metadata.length && ( - - - {(() => { - let data = []; - for (let i = 0; i < metadata.length; i++) { - data.push( - - - - - ); - } - return data; - })()} - -
+
+ {metadata.map((pair, i) => ( +
+
+
+
+ ))} +
) || null} {info} -- cgit From 5d8052e7156c913a551b923c51d508b1ea8837b3 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 9 May 2018 22:19:10 +0200 Subject: Add bot badge to account headers in the WebUI --- .../flavours/glitch/features/account/components/header.js | 5 +++++ app/javascript/flavours/glitch/styles/components/accounts.scss | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'app/javascript/flavours/glitch/features/account/components/header.js') diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 044155cd8..15bd6b365 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -38,6 +38,8 @@ export default class Header extends ImmutablePureComponent { let displayName = account.get('display_name_html'); let fields = account.get('fields'); + let badge = account.get('bot') ? (
) : null; + let info = ''; let mutingInfo = ''; let actionBtn = ''; @@ -99,6 +101,9 @@ export default class Header extends ImmutablePureComponent { @{account.get('acct')} {account.get('locked') ? : null} + + {badge} +
{fields.size > 0 && ( diff --git a/app/javascript/flavours/glitch/styles/components/accounts.scss b/app/javascript/flavours/glitch/styles/components/accounts.scss index 84d3f6ade..5167a507e 100644 --- a/app/javascript/flavours/glitch/styles/components/accounts.scss +++ b/app/javascript/flavours/glitch/styles/components/accounts.scss @@ -509,3 +509,9 @@ margin-bottom: 0; } } + +.account__header .roles { + margin-top: 20px; + margin-bottom: 20px; + padding: 0 15px; +} -- cgit From f6ec8c48210f6bce421d0d7248737d028ae88ee3 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Thu, 10 May 2018 13:04:55 +0200 Subject: [Glitch] Use plaintext value for field value tooltips in web UI Port d185f3ddafc941e280de7efc6d448449ab5ce2c9 to glitch-soc This doesn't change anything for glitch-style fields, but those will go away eventually --- app/javascript/flavours/glitch/actions/notifications.js | 8 +------- .../flavours/glitch/features/account/components/header.js | 2 +- app/javascript/flavours/glitch/reducers/accounts.js | 2 ++ app/javascript/flavours/glitch/util/html.js | 6 ++++++ 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 app/javascript/flavours/glitch/util/html.js (limited to 'app/javascript/flavours/glitch/features/account/components/header.js') diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index cf27eff90..0d52100b9 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -3,6 +3,7 @@ import { List as ImmutableList } from 'immutable'; import IntlMessageFormat from 'intl-messageformat'; import { fetchRelationships } from './accounts'; import { defineMessages } from 'react-intl'; +import { unescapeHTML } from 'flavours/glitch/util/html'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; @@ -40,13 +41,6 @@ const fetchRelatedRelationships = (dispatch, notifications) => { } }; -const unescapeHTML = (html) => { - const wrapper = document.createElement('div'); - html = html.replace(/
|
|\n/g, ' '); - wrapper.innerHTML = html; - return wrapper.textContent; -}; - export function updateNotifications(notification, intlMessages, intlLocale) { return (dispatch, getState) => { const showAlert = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true); diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 15bd6b365..464c73c9a 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -111,7 +111,7 @@ export default class Header extends ImmutablePureComponent { {fields.map((pair, i) => (
-
+
))}
diff --git a/app/javascript/flavours/glitch/reducers/accounts.js b/app/javascript/flavours/glitch/reducers/accounts.js index 23fbd999c..e8127a871 100644 --- a/app/javascript/flavours/glitch/reducers/accounts.js +++ b/app/javascript/flavours/glitch/reducers/accounts.js @@ -57,6 +57,7 @@ import { STORE_HYDRATE } from 'flavours/glitch/actions/store'; import emojify from 'flavours/glitch/util/emoji'; import { Map as ImmutableMap, fromJS } from 'immutable'; import escapeTextContentForBrowser from 'escape-html'; +import { unescapeHTML } from 'flavours/glitch/util/html'; const normalizeAccount = (state, account) => { account = { ...account }; @@ -74,6 +75,7 @@ const normalizeAccount = (state, account) => { ...pair, name_emojified: emojify(escapeTextContentForBrowser(pair.name)), value_emojified: emojify(pair.value), + value_plain: unescapeHTML(pair.value), })); } diff --git a/app/javascript/flavours/glitch/util/html.js b/app/javascript/flavours/glitch/util/html.js new file mode 100644 index 000000000..0b646ce58 --- /dev/null +++ b/app/javascript/flavours/glitch/util/html.js @@ -0,0 +1,6 @@ +export const unescapeHTML = (html) => { + const wrapper = document.createElement('div'); + html = html.replace(/
|
|\n/g, ' '); + wrapper.innerHTML = html; + return wrapper.textContent; +}; -- cgit