1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

fix code format (#6365)

This commit is contained in:
Michael An
2024-07-18 11:58:42 +08:00
committed by GitHub
parent c5d02b33b2
commit 67210c7363
450 changed files with 2425 additions and 2385 deletions

View File

@@ -94,7 +94,7 @@ class Account extends Component {
});
this.isFirstMounted = false;
} else {
this.setState({showInfo: !this.state.showInfo});
this.setState({ showInfo: !this.state.showInfo });
}
};
@@ -153,7 +153,7 @@ class Account extends Component {
{this.renderAvatar()}
</a>
<span className="account-toggle sf2-icon-more mobile-icon d-md-none" aria-label={gettext('View profile and more')} onClick={this.onClickAccount}></span>
<div id="user-info-popup" className={`account-popup sf-popover ${this.state.showInfo? '':'hide'}`}>
<div id="user-info-popup" className={`account-popup sf-popover ${this.state.showInfo ? '' : 'hide'}`}>
<div className="outer-caret up-outer-caret">
<div className="inner-caret"></div>
</div>
@@ -165,7 +165,7 @@ class Account extends Component {
<div id="space-traffic">
<div className="item">
<p>{gettext('Used:')}{' '}{this.state.quotaUsage} / {this.state.quotaTotal}</p>
<div id="quota-bar"><span id="quota-usage" className="usage" style={{width: this.state.usageRate}}></span></div>
<div id="quota-bar"><span id="quota-usage" className="usage" style={{ width: this.state.usageRate }}></span></div>
</div>
</div>
<a href={siteRoot + 'profile/'} className="item">{gettext('Settings')}</a>

View File

@@ -29,9 +29,9 @@ export const EVENT_BUS_TYPE = {
// modify view
MODIFY_FILTERS: 'modify_filters',
MODIFY_SORTS:'modify_sorts',
MODIFY_GROUPBYS:'modify_groupbys',
MODIFY_HIDDEN_COLUMNS:'modify_hidden_columns',
MODIFY_SORTS: 'modify_sorts',
MODIFY_GROUPBYS: 'modify_groupbys',
MODIFY_HIDDEN_COLUMNS: 'modify_hidden_columns',
// change
VIEW_CHANGED: 'view_changed',

View File

@@ -4,7 +4,7 @@ import { siteRoot, gettext } from '../../utils/constants';
export default function Logout() {
return (
<a className="logout-icon" href={`${siteRoot}accounts/logout/`} title={gettext('Log out')}>
<i className="sf3-font sf3-font-logout" style={{fontSize: '24px'}}></i>
<i className="sf3-font sf3-font-logout" style={{ fontSize: '24px' }}></i>
</a>
);
}

View File

@@ -25,7 +25,7 @@ const MSG_TYPE_REPO_SHARE_PERM_DELETE = 'repo_share_perm_delete';
class NoticeItem extends React.Component {
generatorNoticeInfo () {
generatorNoticeInfo() {
let noticeItem = this.props.noticeItem;
let noticeType = noticeItem.type;
let detail = noticeItem.detail;
@@ -48,7 +48,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{user_link}', userLink);
notice = notice.replace('{group_link}', groupLink);
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_SHARE) {
@@ -58,7 +58,7 @@ class NoticeItem extends React.Component {
let shareFrom = detail.share_from_user_name;
let repoName = detail.repo_name;
let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/';
let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/';
let path = detail.path;
let notice = '';
@@ -78,7 +78,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{tagA}', `<a href='${Utils.encodePath(repoUrl)}'>`);
notice = notice.replace('{/tagA}', '</a>');
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_SHARE_PERM_CHANGE) {
@@ -87,7 +87,7 @@ class NoticeItem extends React.Component {
let shareFrom = detail.share_from_user_name;
let permission = detail.permission;
let repoName = detail.repo_name;
let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/';
let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/';
let path = detail.path;
let notice = '';
// 1. handle translate
@@ -107,7 +107,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{tagA}', `<a href='${Utils.encodePath(repoUrl)}'>`);
notice = notice.replace('{/tagA}', '</a>');
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_SHARE_PERM_DELETE) {
@@ -128,7 +128,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{share_from}', shareFrom);
notice = notice.replace('{repo_name}', repoName);
notice = Utils.HTMLescape(notice);
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_SHARE_TO_GROUP) {
@@ -147,9 +147,9 @@ class NoticeItem extends React.Component {
let notice = '';
// 1. handle translate
if (path === '/') {
notice = gettext('{share_from} has shared a library named {repo_link} to group {group_link}.');
notice = gettext('{share_from} has shared a library named {repo_link} to group {group_link}.');
} else {
notice = gettext('{share_from} has shared a folder named {repo_link} to group {group_link}.');
notice = gettext('{share_from} has shared a folder named {repo_link} to group {group_link}.');
}
// 2. handle xss(cross-site scripting)
@@ -163,7 +163,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{/tagA}', '</a>');
notice = notice.replace('{tagB}', `<a href='${Utils.encodePath(groupUrl)}'>`);
notice = notice.replace('{/tagB}', '</a>');
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_TRANSFER) {
@@ -185,7 +185,7 @@ class NoticeItem extends React.Component {
// 3. add jump link
notice = notice.replace('{tagA}', `<a href=${Utils.encodePath(repoUrl)}>`);
notice = notice.replace('{/tagA}', '</a>');
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_FILE_UPLOADED) {
@@ -218,7 +218,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{upload_file_link}', `${fileName}`);
notice = Utils.HTMLescape(notice);
}
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_FOLDER_UPLOADED) {
@@ -251,7 +251,7 @@ class NoticeItem extends React.Component {
notice = notice.replace('{upload_folder_link}', `${folderName}`);
notice = Utils.HTMLescape(notice);
}
return {avatar_url, notice};
return { avatar_url, notice };
}
if (noticeType === MSG_TYPE_REPO_MONITOR) {
@@ -348,21 +348,21 @@ class NoticeItem extends React.Component {
let notice = gettext('Your library {libraryName} has recently deleted a large number of files.');
notice = notice.replace('{libraryName}', repoLink);
return { avatar_url : null, notice };
return { avatar_url: null, notice };
}
if (noticeType === MSG_TYPE_SAML_SSO_FAILED) {
const { error_msg } = detail;
let notice = gettext(error_msg);
return { avatar_url : null, notice };
return { avatar_url: null, notice };
}
// if (noticeType === MSG_TYPE_GUEST_INVITATION_ACCEPTED) {
// }
return {avatar_url : null, notice : null};
return { avatar_url: null, notice: null };
}
onNoticeItemClick = () => {
@@ -387,7 +387,7 @@ class NoticeItem extends React.Component {
<img src={avatar_url} width="32" height="32" className="avatar" alt="" />
</td>
<td className="pr-1 pr-md-8">
<p className="m-0" dangerouslySetInnerHTML={{__html: notice}}></p>
<p className="m-0" dangerouslySetInnerHTML={{ __html: notice }}></p>
</td>
<td>
{moment(noticeItem.time).fromNow()}
@@ -398,7 +398,7 @@ class NoticeItem extends React.Component {
<div className="notice-item">
<div className="main-info">
<img src={avatar_url} width="32" height="32" className="avatar" alt=""/>
<p className="brief" dangerouslySetInnerHTML={{__html: notice}}></p>
<p className="brief" dangerouslySetInnerHTML={{ __html: notice }}></p>
</div>
<p className="time">{moment(noticeItem.time).fromNow()}</p>
</div>

View File

@@ -20,7 +20,7 @@ class Notification extends React.Component {
componentDidMount() {
seafileAPI.getUnseenNotificationCount().then(res => {
this.setState({unseenCount: res.data.unseen_count});
this.setState({ unseenCount: res.data.unseen_count });
});
}
@@ -34,7 +34,7 @@ class Notification extends React.Component {
});
} else {
this.loadNotices();
this.setState({showNotice: true});
this.setState({ showNotice: true });
}
};
@@ -43,7 +43,7 @@ class Notification extends React.Component {
let perPage = 5;
seafileAPI.listNotifications(page, perPage).then(res => {
let noticeList = res.data.notification_list;
this.setState({noticeList: noticeList});
this.setState({ noticeList: noticeList });
});
};
@@ -71,11 +71,11 @@ class Notification extends React.Component {
onNotificationDialogToggle = () => {
let newSearch = this.state.isShowNotificationDialog ? null : 'all';
Utils.updateSearchParameter('notifications', newSearch);
this.setState({isShowNotificationDialog: !this.state.isShowNotificationDialog});
this.setState({ isShowNotificationDialog: !this.state.isShowNotificationDialog });
};
onNotificationListToggle = () => {
this.setState({showNotice: false});
this.setState({ showNotice: false });
};
onMarkAllNotifications = () => {

View File

@@ -40,7 +40,7 @@ class SearchInput extends Component {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({searchValue: nextProps.value});
this.setState({ searchValue: nextProps.value });
}
}
@@ -58,7 +58,7 @@ class SearchInput extends Component {
this.timer && clearTimeout(this.timer);
const { onChange, wait } = this.props;
let text = e.target.value;
this.setState({searchValue: text || ''}, () => {
this.setState({ searchValue: text || '' }, () => {
if (this.isInputtingChinese) return;
this.timer = setTimeout(() => {
onChange && onChange(this.state.searchValue.trim());
@@ -73,7 +73,7 @@ class SearchInput extends Component {
clearSearch = () => {
const { clearValue } = this.props;
this.setState({searchValue: ''}, () => {
this.setState({ searchValue: '' }, () => {
clearValue && clearValue();
});
};
@@ -98,7 +98,7 @@ class SearchInput extends Component {
if (!isClearable || !searchValue) return null;
const { ClearIndicator } = components;
if (React.isValidElement(ClearIndicator)) {
return React.cloneElement(ClearIndicator, {clearValue: this.clearSearch});
return React.cloneElement(ClearIndicator, { clearValue: this.clearSearch });
} else if (this.isFunction(ClearIndicator)) {
return <ClearIndicator clearValue={this.clearSearch} />;
}

View File

@@ -4,7 +4,7 @@ import { gettext } from '../../../utils/constants';
const NoGroupMessage = (props) => {
return (
<div {...props.innerProps} style={{margin: '6px 10px', textAlign: 'center', color: 'hsl(0,0%,50%)'}}>{gettext('Group not found')}</div>
<div {...props.innerProps} style={{ margin: '6px 10px', textAlign: 'center', color: 'hsl(0,0%,50%)' }}>{gettext('Group not found')}</div>
);
};

View File

@@ -16,7 +16,7 @@ const MenuSelectStyle = {
cursor: 'pointer',
lineHeight: '1.5',
}),
menuPortal: base => ({ ...base, zIndex: 9999 }),
menuPortal: base => ({ ...base, zIndex: 9999 }),
indicatorSeparator: () => {},
};

View File

@@ -6,7 +6,7 @@ import '../../../css/switch.css';
function Switch(props) {
const { onChange, checked, placeholder, disabled, className, size, textPosition, setRef } = props;
return(
return (
<div className={classnames('seahub-switch position-relative', className, size)} ref={setRef}>
<label className="custom-switch">
<input
@@ -20,7 +20,7 @@ function Switch(props) {
{textPosition === 'left' &&
<span className="custom-switch-description text-truncate">{placeholder}</span>
}
<span className={classnames('custom-switch-indicator', {'disabled': disabled})}></span>
<span className={classnames('custom-switch-indicator', { 'disabled': disabled })}></span>
{textPosition === 'right' &&
<span className="custom-switch-description text-truncate">{placeholder}</span>
}