mirror of https://github.com/casbin/casnode.git
Fix UI for anonymous user.
This commit is contained in:
parent
116483078a
commit
7b4ff0b44a
|
@ -48,6 +48,20 @@ class Avatar extends React.Component {
|
|||
src = Setting.getUserAvatar(this.props.username);
|
||||
}
|
||||
|
||||
if (this.props.username === "" || this.props.username === "客人") {
|
||||
return (
|
||||
<img
|
||||
src={"https://cdn.casbin.com/avatar-pool/anonymous.png"}
|
||||
className="avatar"
|
||||
border="0"
|
||||
align="default"
|
||||
style={style}
|
||||
alt={"Anonymous User"}
|
||||
key={this.props.key}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Link to={`/member/${this.props.username}`}>
|
||||
<img
|
||||
|
|
|
@ -33,7 +33,6 @@ export let ServerUrl = "";
|
|||
export let ClientUrl = "";
|
||||
export let CasdoorSdk;
|
||||
|
||||
// export const StaticBaseUrl = "https://cdn.jsdelivr.net/gh/casbin/static";
|
||||
export const StaticBaseUrl = "https://cdn.casbin.org";
|
||||
|
||||
export function initServerUrl() {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright 2021 The casbin Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import i18next from "i18next";
|
||||
|
||||
class UserLink extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
classes: props,
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.username === "" || this.props.username === "客人") {
|
||||
return (
|
||||
<span className={`${this.props.classNameText}`}>
|
||||
{i18next.t("general:Anonymous")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={`/member/${this.props.username}`}
|
||||
className={`${this.props.classNameText}`}
|
||||
>
|
||||
{this.props.username}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default UserLink;
|
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "Admin",
|
||||
"Anonymous": "Anonymous",
|
||||
"Home": "Home",
|
||||
"Homepage": "Homepage",
|
||||
"Language": "Language",
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "Admin",
|
||||
"Anonymous": "Anonymous",
|
||||
"Home": "Home",
|
||||
"Homepage": "Homepage",
|
||||
"Language": "Language",
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "Admin",
|
||||
"Anonymous": "Anonymous",
|
||||
"Home": "Home",
|
||||
"Homepage": "Homepage",
|
||||
"Language": "Language",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "Admin",
|
||||
"Anonymous": "Anonymous",
|
||||
"Home": "Home",
|
||||
"Homepage": "Homepage",
|
||||
"Language": "Language",
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "Админ",
|
||||
"Anonymous": "Anonymous",
|
||||
"Home": "Домой",
|
||||
"Homepage": "Домашняя страница",
|
||||
"Language": "Язык",
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
},
|
||||
"general": {
|
||||
"Admin": "后台",
|
||||
"Anonymous": "匿名",
|
||||
"Home": "首页",
|
||||
"Homepage": "个人主页",
|
||||
"Language": "语言选择",
|
||||
|
|
|
@ -22,7 +22,6 @@ import AllCreatedTopicsBox from "./AllCreatedTopicsBox";
|
|||
import LatestReplyBox from "./LatestReplyBox";
|
||||
import i18next from "i18next";
|
||||
import { scoreConverter } from "./Tools";
|
||||
import { getProviderLogoLink } from "../Setting";
|
||||
|
||||
class MemberBox extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import PageColumn from "./PageColumn";
|
|||
import ReactMarkdown from "react-markdown";
|
||||
import Zmage from "react-zmage";
|
||||
import i18next from "i18next";
|
||||
import UserLink from "../UserLink";
|
||||
|
||||
// const pangu = require("pangu");
|
||||
const maxReplyDepth = Setting.PcBrowser
|
||||
|
@ -408,9 +409,7 @@ class ReplyBox extends React.Component {
|
|||
)}
|
||||
</div>
|
||||
<strong>
|
||||
<Link to={`/member/${reply.author}`} className="dark">
|
||||
{reply.author}
|
||||
</Link>
|
||||
<UserLink username={reply.author} classNameText={"dark"} />
|
||||
</strong>
|
||||
<Link
|
||||
className="ago"
|
||||
|
|
|
@ -26,6 +26,7 @@ import "../node.css";
|
|||
import Zmage from "react-zmage";
|
||||
import { Link } from "react-router-dom";
|
||||
import i18next from "i18next";
|
||||
import UserLink from "../UserLink";
|
||||
|
||||
require("codemirror/mode/markdown/markdown");
|
||||
|
||||
|
@ -616,9 +617,7 @@ class TopicBox extends React.Component {
|
|||
<tr>
|
||||
<td align="right">{i18next.t("topic:Creator")}</td>
|
||||
<td align="left">
|
||||
<Link to={`/member/${this.state.topic?.author}`}>
|
||||
{this.state.topic?.author}
|
||||
</Link>
|
||||
<UserLink username={this.state.topic?.author} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -751,12 +750,10 @@ class TopicBox extends React.Component {
|
|||
</span>
|
||||
) : null}
|
||||
<small className="gray">
|
||||
<Link
|
||||
to={`/member/${this.state.topic?.author}`}
|
||||
className={`${this.state.topic.nodeId}`}
|
||||
>
|
||||
{this.state.topic?.author}
|
||||
</Link>{" "}
|
||||
<UserLink
|
||||
username={this.state.topic?.author}
|
||||
classNameText={`${this.state.topic.nodeId}`}
|
||||
/>{" "}
|
||||
· {Setting.getPrettyDate(this.state.topic?.createdTime)} ·{" "}
|
||||
{this.state.topic?.hitCount} {i18next.t("topic:hits")}
|
||||
{" "}
|
||||
|
|
|
@ -19,6 +19,7 @@ import Avatar from "../Avatar";
|
|||
import "../node.css";
|
||||
import i18next from "i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import UserLink from "../UserLink";
|
||||
const pangu = require("pangu");
|
||||
|
||||
class TopicList extends React.Component {
|
||||
|
@ -110,9 +111,10 @@ class TopicList extends React.Component {
|
|||
</Link>{" "}
|
||||
• {" "}
|
||||
<strong>
|
||||
<Link to={`/member/${topic.author}`} className="node">
|
||||
{topic.author}
|
||||
</Link>
|
||||
<UserLink
|
||||
username={topic.author}
|
||||
classNameText={"node"}
|
||||
/>
|
||||
</strong>
|
||||
</span>
|
||||
) : null}
|
||||
|
@ -145,12 +147,10 @@ class TopicList extends React.Component {
|
|||
</span>
|
||||
) : null}
|
||||
<strong>
|
||||
<Link
|
||||
to={`/member/${topic.author}`}
|
||||
className={`${this.props.nodeId} member`}
|
||||
>
|
||||
{topic.author}
|
||||
</Link>
|
||||
<UserLink
|
||||
username={topic.author}
|
||||
classNameText={`${this.props.nodeId} member`}
|
||||
/>
|
||||
</strong>{" "}
|
||||
• {" "}
|
||||
{topic.lastReplyTime === "" ||
|
||||
|
@ -164,12 +164,10 @@ class TopicList extends React.Component {
|
|||
"topic:last reply from"
|
||||
)}{" "}
|
||||
<strong>
|
||||
<Link
|
||||
to={`/member/${topic.lastReplyUser}`}
|
||||
className={`${this.props.nodeId} member`}
|
||||
>
|
||||
{topic.lastReplyUser}
|
||||
</Link>
|
||||
<UserLink
|
||||
username={topic.lastReplyUser}
|
||||
classNameText={`${this.props.nodeId} member`}
|
||||
/>
|
||||
</strong>
|
||||
</div>
|
||||
)}
|
||||
|
@ -189,12 +187,10 @@ class TopicList extends React.Component {
|
|||
"topic:last reply from"
|
||||
)}{" "}
|
||||
<strong>
|
||||
<Link
|
||||
to={`/member/${topic.lastReplyUser}`}
|
||||
className={`${this.props.nodeId} member`}
|
||||
>
|
||||
{topic.lastReplyUser}
|
||||
</Link>
|
||||
<UserLink
|
||||
username={topic.lastReplyUser}
|
||||
classNameText={`${this.props.nodeId} member`}
|
||||
/>
|
||||
</strong>
|
||||
</div>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue