This commit is contained in:
or-else
2021-08-03 20:09:40 -07:00
parent 59138c9f5f
commit 274da95b71
20 changed files with 342 additions and 115 deletions
+8 -4
View File
@@ -248,6 +248,11 @@ textarea {
resize: none; resize: none;
padding-top: 0.45rem; padding-top: 0.45rem;
} }
textarea.inplace-edit {
height: unset;
}
/* END of input and buttons */ /* END of input and buttons */
/* BEGIN scrollbar styling. */ /* BEGIN scrollbar styling. */
@@ -1042,7 +1047,7 @@ i.search {
flex-direction: column; flex-direction: column;
flex-shrink: 0; flex-shrink: 0;
width: 8rem; width: 8rem;
height: 10rem; height: 8.5rem;
margin-left: 0.5rem; margin-left: 0.5rem;
font-size: 4.5rem; font-size: 4.5rem;
padding: 0; padding: 0;
@@ -1134,6 +1139,7 @@ i.search {
.avatar-upload .inputfile + label.round { .avatar-upload .inputfile + label.round {
display: flex; display: flex;
position: absolute;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
@@ -1142,10 +1148,8 @@ i.search {
line-height: 3rem; line-height: 3rem;
border-radius: 50%; border-radius: 50%;
box-shadow: 0 1px 4px rgba(0,0,0,0.4); box-shadow: 0 1px 4px rgba(0,0,0,0.4);
margin-left: auto;
margin-right: auto;
margin-top: -1rem;
bottom: 0; bottom: 0;
right: 0;
background-color: #fafafa; background-color: #fafafa;
z-index: 1; z-index: 1;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "Optional description",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": false,
"obsolete": false
},
"label_description": {
"translation": "Description",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": false,
"obsolete": false
} }
} }
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+8
View File
@@ -183,6 +183,10 @@
"defaultMessage": "content deleted", "defaultMessage": "content deleted",
"description": "Shown when messages are deleted" "description": "Shown when messages are deleted"
}, },
"description_editing_placeholder": {
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description"
},
"download_action": { "download_action": {
"defaultMessage": "download", "defaultMessage": "download",
"description": "Call to action [download]" "description": "Call to action [download]"
@@ -271,6 +275,10 @@
"defaultMessage": "Default access mode:", "defaultMessage": "Default access mode:",
"description": "Label for default access mode" "description": "Label for default access mode"
}, },
"label_description": {
"defaultMessage": "Description",
"description": "Label for editing topic description"
},
"label_file_name": { "label_file_name": {
"defaultMessage": "File name:", "defaultMessage": "File name:",
"description": "Label for a file name" "description": "Label for a file name"
+14
View File
@@ -1280,5 +1280,19 @@
"translation": "메시지에접근할수없음", "translation": "메시지에접근할수없음",
"missing": false, "missing": false,
"obsolete": true "obsolete": true
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+20 -6
View File
@@ -58,7 +58,7 @@
"badge_danger": { "badge_danger": {
"defaultMessage": "Untrustworthy", "defaultMessage": "Untrustworthy",
"description": "Suspicious or untrustworthy account or topic badge", "description": "Suspicious or untrustworthy account or topic badge",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"badge_owner": { "badge_owner": {
@@ -71,13 +71,13 @@
"badge_staff": { "badge_staff": {
"defaultMessage": "Staff-managed", "defaultMessage": "Staff-managed",
"description": "Explanation of a staff-managed account or topic badge", "description": "Explanation of a staff-managed account or topic badge",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"badge_verified": { "badge_verified": {
"defaultMessage": "Verified/official", "defaultMessage": "Verified/official",
"description": "Explanation of a verified account or topic badge", "description": "Explanation of a verified account or topic badge",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"badge_you": { "badge_you": {
@@ -300,7 +300,7 @@
"delete_account_warning": { "delete_account_warning": {
"defaultMessage": "Are you sure you want to delete your account? It cannot be undone.", "defaultMessage": "Are you sure you want to delete your account? It cannot be undone.",
"description": "Warning message when deleting an account", "description": "Warning message when deleting an account",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"delete_messages_warning": { "delete_messages_warning": {
@@ -759,7 +759,7 @@
"menu_item_restore_topic": { "menu_item_restore_topic": {
"defaultMessage": "Restore", "defaultMessage": "Restore",
"description": "Restore topic from archive", "description": "Restore topic from archive",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"menu_item_send_retry": { "menu_item_send_retry": {
@@ -1080,7 +1080,7 @@
"sidepanel_title_crop": { "sidepanel_title_crop": {
"defaultMessage": "Drag to Adjust", "defaultMessage": "Drag to Adjust",
"description": "Sidepanel title for AvatarCropView.", "description": "Sidepanel title for AvatarCropView.",
"missing": false, "missing": true,
"obsolete": false "obsolete": false
}, },
"sidepanel_title_login": { "sidepanel_title_login": {
@@ -1269,5 +1269,19 @@
"translation": "您確定要刪除您的帳號嗎?此操作無法復原。", "translation": "您確定要刪除您的帳號嗎?此操作無法復原。",
"missing": false, "missing": false,
"obsolete": true "obsolete": true
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+14
View File
@@ -1270,5 +1270,19 @@
"description": "Validate credentail call to action", "description": "Validate credentail call to action",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
},
"description_editing_placeholder": {
"translation": "",
"defaultMessage": "Optional description",
"description": "Placeholder for editing topic description",
"missing": true,
"obsolete": false
},
"label_description": {
"translation": "",
"defaultMessage": "Description",
"description": "Label for editing topic description",
"missing": true,
"obsolete": false
} }
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+40 -36
View File
@@ -1,6 +1,5 @@
// In-place text editor. Shows text with an icon which toggles it into an input field. // In-place text editor. Shows text with an icon which toggles it into an input field.
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom';
import VisiblePassword from './visible-password.jsx'; import VisiblePassword from './visible-password.jsx';
@@ -8,6 +7,8 @@ export default class InPlaceEdit extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.selfRef = React.createRef();
this.state = { this.state = {
active: props.active, active: props.active,
initialValue: props.value || '', initialValue: props.value || '',
@@ -47,10 +48,13 @@ export default class InPlaceEdit extends React.Component {
} }
} }
handleStartEditing() { handleStartEditing() {
if (!this.props.readOnly) { if (!this.props.readOnly) {
ReactDOM.findDOMNode(this).focus(); this.setState({active: true}, () => {
this.setState({active: true}); if (this.selfRef.current) {
this.selfRef.current.focus();
}
});
} }
} }
@@ -75,12 +79,9 @@ export default class InPlaceEdit extends React.Component {
} }
render() { render() {
if (this.state.active) { if (!this.state.active) {
var fieldType = this.props.type || 'text'; let spanText = this.props.type == 'password' ? '••••••••' : this.state.value;
} else { let spanClass = 'in-place-edit' + (this.props.readOnly ? ' disabled' : '');
var spanText = this.props.type == 'password' ? '••••••••' : this.state.value;
var spanClass = 'in-place-edit' +
(this.props.readOnly ? ' disabled' : '');
if (!spanText) { if (!spanText) {
spanText = this.props.placeholder; spanText = this.props.placeholder;
spanClass += ' placeholder'; spanClass += ' placeholder';
@@ -89,32 +90,35 @@ export default class InPlaceEdit extends React.Component {
// FIXME: this is wrong for RTL languages. // FIXME: this is wrong for RTL languages.
spanText = spanText.substring(0, 19) + '...'; spanText = spanText.substring(0, 19) + '...';
} }
return (<span className={spanClass} onClick={this.handleStartEditing}>
<span className="content">{spanText}</span>
</span>);
} }
return (
this.state.active ? let element;
(fieldType == 'password' ? let attr = {};
<VisiblePassword if (this.props.type == 'password') {
value={this.state.value} element = VisiblePassword;
placeholder={this.props.placeholder} attr.onFinished = this.handlePasswordFinished;
required={this.props.required ? 'required' : ''} } else {
autoComplete={this.props.autoComplete} if (this.props.multiline > 1) {
autoFocus={true} element = 'textarea';
onFinished={this.handlePasswordFinished}/> attr.rows = this.props.multiline;
: attr.className = 'inplace-edit';
<input type={fieldType} } else {
value={this.state.value} element = 'input';
placeholder={this.props.placeholder} attr.type = this.props.type || 'text';
required={this.props.required ? 'required' : ''} }
autoComplete={this.props.autoComplete} attr.onChange = this.handeTextChange;
autoFocus attr.onKeyDown = this.handleKeyDown;
onChange={this.handeTextChange} attr.onBlur = this.handleEditingFinished;
onKeyDown={this.handleKeyDown} }
onBlur={this.handleEditingFinished} /> attr.placeholder = this.props.placeholder;
) attr.required = this.props.required ? 'required' : '';
: attr.autoComplete = this.props.autoComplete;
<span className={spanClass} onClick={this.handleStartEditing}> attr.autoFocus = true;
<span className="content">{spanText}</span> attr.ref = this.selfRef;
</span>
); return React.createElement(element, attr, null);
} }
}; };
+20 -2
View File
@@ -22,7 +22,7 @@ export default class TopicDescEdit extends React.Component {
const topic = this.props.tinode.getTopic(this.props.topic); const topic = this.props.tinode.getTopic(this.props.topic);
const acs = topic.getAccessMode(); const acs = topic.getAccessMode();
this.state = { this.state = {
isMe: this.props.tinode.isMe(this.props.topic), isMe: Tinode.isMeTopicName(this.props.topic),
owner: acs && acs.isOwner(), owner: acs && acs.isOwner(),
fullName: topic.public ? topic.public.fn : undefined, fullName: topic.public ? topic.public.fn : undefined,
avatar: makeImageUrl(topic.public ? topic.public.photo : null), avatar: makeImageUrl(topic.public ? topic.public.photo : null),
@@ -155,7 +155,7 @@ export default class TopicDescEdit extends React.Component {
<> <>
<div className="panel-form-row"> <div className="panel-form-row">
<div className="panel-form-column"> <div className="panel-form-column">
{this.state.me ? <> {this.state.isMe ? <>
<label className="small"> <label className="small">
<FormattedMessage id="label_your_name" defaultMessage="Your name" <FormattedMessage id="label_your_name" defaultMessage="Your name"
description="Label for full name editing" /> description="Label for full name editing" />
@@ -205,6 +205,24 @@ export default class TopicDescEdit extends React.Component {
onImageUpdated={this.handleImageUpdated} onImageUpdated={this.handleImageUpdated}
onError={this.props.onError} /> onError={this.props.onError} />
</div> </div>
<div className="panel-form-column">
<div><label className="small">
<FormattedMessage id="label_description" defaultMessage="Description"
description="Label for editing topic description" />
</label></div>
<div>
<FormattedMessage id="description_editing_placeholder"
defaultMessage="Optional description"
description="Placeholder for editing topic description">{
(private_placeholder) => <InPlaceEdit
placeholder={private_placeholder}
readOnly={!editable}
value={this.state.description}
multiline={2}
onFinished={this.handleDescriptionUpdate} />
}</FormattedMessage>
</div>
</div>
{editable ? {editable ?
<> <>
<div className="hr" /> <div className="hr" />
+69 -37
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+73 -24
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long