Skip to content

Commit c0f4524

Browse files
committed
Apply CC license for articles
1 parent c6d2c8f commit c0f4524

File tree

12 files changed

+144
-4
lines changed

12 files changed

+144
-4
lines changed

public/assets/img/cc/by.svg

+20
Loading

public/assets/img/cc/cc.svg

+27
Loading

public/assets/img/cc/nc.svg

+23
Loading

public/assets/img/cc/sa.svg

+22
Loading

src/components/Article.scss

+12
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@
3838
align-items: center;
3939
margin-top: 16px;
4040
}
41+
42+
.copyleft {
43+
display: block;
44+
margin-top: 8px;
45+
text-align: right;
46+
47+
.cc-icon {
48+
width: 20px;
49+
height: 20px;
50+
margin-right: 4px;
51+
}
52+
}

src/components/Article.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,23 @@ export default class Article extends React.Component<ArticleProps, ArticleState>
110110
__html: renderMarkdown(article.content)
111111
}}
112112
/>
113+
113114
{article.tags.length > 0 && (
114115
<div className="article-footer">
115116
{article.tags.map((tag, i) => <Tag key={i}>{tag}</Tag>)}
116117
</div>
117118
)}
119+
120+
<a
121+
className="copyleft"
122+
href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"
123+
target="_blank"
124+
>
125+
<img className="cc-icon" src="/assets/img/cc/cc.svg" alt="CC" />
126+
<img className="cc-icon" src="/assets/img/cc/by.svg" alt="BY" />
127+
<img className="cc-icon" src="/assets/img/cc/nc.svg" alt="NC" />
128+
<img className="cc-icon" src="/assets/img/cc/sa.svg" alt="SA" />
129+
</a>
118130
</Card>
119131
</WithSidebar>
120132
</div>

src/components/EditArticle.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './parts/Editor.scss';
21
import React from 'react';
32
import { Article, nullArticle, User } from '@/types';
43
import { State } from '@/reducers';

src/components/NewArticle.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './parts/Editor.scss';
21
import React from 'react';
32
import { Article, nullArticle, User } from '@/types';
43
import { State } from '@/reducers';

src/components/admin/Admin.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ export class Admin extends React.PureComponent<AdminProps> {
6262
<div className={'flex-spacer ' + (this.props.immersive || 'container-fluid panel-container')}>
6363
<Switch>
6464
<Route exact path="/admin" component={Overview} />
65+
6566
<Route path="/admin/articles/all" component={AllArticles} />
6667
<Route path="/admin/articles/pending" component={PendingArticles} />
6768
<Route path="/admin/articles/published" component={PublishedArticles} />
6869
<Route path="/admin/articles/preview/:id(\w+)" component={PreviewArticle} />
70+
71+
<Route path="/admin/join/invalid" component={PendingArticles} />
72+
<Route path="/admin/join/approved" component={PublishedArticles} />
6973
</Switch>
7074
</div>
7175
</Layout>

src/components/admin/articles/PreviewArticle.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@/components/parts/Editor.scss';
21
import React from 'react';
32
import { Article, ArticleStatus, nullArticle } from '@/types';
43
import { State } from '@/reducers';

src/components/parts/Editor.scss

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@
6565

6666
display: flex;
6767
flex-direction: row;
68+
align-items: center;
69+
70+
.cc-icon {
71+
width: 28px;
72+
height: 28px;
73+
margin-left: 4px;
74+
}
6875

6976
.submit-button {
7077
margin-left: 16px;

src/components/parts/Editor.tsx

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './Editor.scss';
22
import React, { ChangeEvent } from 'react';
33
import { Article } from '@/types';
4-
import { Button } from 'antd';
4+
import { Button, Popover } from 'antd';
55
import Measure, { BoundingRect, ContentRect } from 'react-measure';
66
import AceEditor from 'react-ace';
77
import 'brace/mode/markdown';
@@ -39,6 +39,15 @@ interface EditorState {
3939
}
4040

4141
export default class Editor extends React.Component<EditorProps, EditorState> {
42+
static copyrightDescription = (
43+
<React.Fragment>
44+
<p>您在本站提交文章时,即授权本站以 CC BY-NC-SA 协议发布该文章。</p>
45+
<p><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">
46+
什么是 CC BY-NC-SA?
47+
</a></p>
48+
</React.Fragment>
49+
);
50+
4251
state = {
4352
title: this.props.article.title,
4453
content: this.props.article.content,
@@ -164,6 +173,13 @@ export default class Editor extends React.Component<EditorProps, EditorState> {
164173
</div>
165174

166175
<div className="editor-footer">
176+
<Popover content={Editor.copyrightDescription} title="著作权说明" placement="topLeft">
177+
<img className="cc-icon" src="/assets/img/cc/cc.svg" alt="CC" />
178+
<img className="cc-icon" src="/assets/img/cc/by.svg" alt="BY" />
179+
<img className="cc-icon" src="/assets/img/cc/nc.svg" alt="NC" />
180+
<img className="cc-icon" src="/assets/img/cc/sa.svg" alt="SA" />
181+
</Popover>
182+
167183
<div className="flex-spacer" />
168184

169185
<Button

0 commit comments

Comments
 (0)