2
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
3
* License: MS-RSL – see LICENSE.md for details
4
4
*/
5
-
6
5
import { UsergroupAddOutlined } from "@ant-design/icons" ;
7
6
import { Button , Card , Popconfirm } from "antd" ;
7
+ import { FormattedMessage , useIntl } from "react-intl" ;
8
+
8
9
import { AppRedux , useActions } from "@cocalc/frontend/app-framework" ;
9
- import { Icon } from "@cocalc/frontend/components" ;
10
+ import { Icon , Paragraph } from "@cocalc/frontend/components" ;
11
+ import { course } from "@cocalc/frontend/i18n" ;
10
12
import { CancelText } from "@cocalc/frontend/i18n/components" ;
11
13
import { CourseActions } from "../actions" ;
12
14
import { CourseSettingsRecord } from "../store" ;
@@ -25,47 +27,68 @@ export function SharedProjectPanel({
25
27
name,
26
28
close,
27
29
} : SharedProjectPanelProps ) {
30
+ const intl = useIntl ( ) ;
31
+
28
32
const actions = useActions < CourseActions > ( { name } ) ;
29
33
34
+ const haveSharedProject = ! ! settings . get ( "shared_project_id" ) ;
35
+
30
36
function panel_header_text ( ) : string {
31
- if ( settings . get ( "shared_project_id" ) ) {
32
- return "Shared project that everybody can fully use" ;
33
- } else {
34
- return "Optionally create a shared project for everybody" ;
35
- }
37
+ return intl . formatMessage (
38
+ {
39
+ id : "course.shared-project-panel.header" ,
40
+ defaultMessage : `{haveSharedProject, select,
41
+ true {Shared project that everybody can fully use}
42
+ other {Optionally create a shared project for everybody}}` ,
43
+ } ,
44
+ { haveSharedProject } ,
45
+ ) ;
36
46
}
37
47
38
48
function render_content ( ) {
39
- if ( settings . get ( "shared_project_id" ) ) {
49
+ if ( haveSharedProject ) {
40
50
return render_has_shared_project ( ) ;
41
51
} else {
42
52
return render_no_shared_project ( ) ;
43
53
}
44
54
}
45
55
56
+ const icuVals = {
57
+ b : ( c ) => < b > { c } </ b > ,
58
+ i : ( c ) => < i > { c } </ i > ,
59
+ p : ( c ) => < Paragraph > { c } </ Paragraph > ,
60
+ secondary : ( c ) => < Paragraph type = "secondary" > { c } </ Paragraph > ,
61
+ } ;
62
+
46
63
function render_has_shared_project ( ) {
47
64
return (
48
- < div >
49
- < div style = { { color : "#444" } } >
50
- < p >
51
- You created a common shared project, which everybody -- students and
52
- all collaborators on this project (your TAs and other instructors)
53
- -- have < b > write</ b > access to. Use this project for collaborative
54
- in-class labs, course-wide chat rooms, and making miscellaneous
55
- materials available for students to experiment with together.
56
- </ p >
57
- < p >
58
- When you created the shared project, everybody who has already
59
- created an account is added as a collaborator to the project.
60
- Whenever you re-open this course, any students or collaborators on
61
- the project that contains this course will be added to the shared
62
- project.
63
- </ p >
64
- </ div >
65
+ < >
66
+ < FormattedMessage
67
+ id = "course.shared-project-panel.have_project.message"
68
+ defaultMessage = { `
69
+ <p>
70
+ You created a common shared project, which everybody – students and
71
+ all collaborators on this project (your TAs and other instructors)
72
+ – have <b>write</b> access to. Use this project for collaborative
73
+ in-class labs, course-wide chat rooms, and making miscellaneous
74
+ materials available for students to experiment with together.
75
+ </p>
76
+ <secondary>
77
+ When you created the shared project, everybody who has already
78
+ created an account is added as a collaborator to the project.
79
+ Whenever you re-open this course, any students or collaborators on
80
+ the project that contains this course will be added to the shared
81
+ project.
82
+ </secondary>` }
83
+ values = { icuVals }
84
+ />
65
85
< br />
66
86
< div style = { { textAlign : "center" } } >
67
87
< Button onClick = { open_project } size = { "large" } type = { "primary" } >
68
- Open shared project
88
+ < FormattedMessage
89
+ id = "course.shared-project-panel.have_project.button"
90
+ defaultMessage = { "Open shared project" }
91
+ />
69
92
</ Button >
70
93
</ div >
71
94
< hr />
@@ -74,7 +97,7 @@ export function SharedProjectPanel({
74
97
actions = { actions }
75
98
close = { close }
76
99
/>
77
- </ div >
100
+ </ >
78
101
) ;
79
102
}
80
103
@@ -88,34 +111,38 @@ export function SharedProjectPanel({
88
111
function render_no_shared_project ( ) {
89
112
return (
90
113
< div >
91
- < div style = { { color : "#444" } } >
92
- < p >
93
- < i > Optionally</ i > create a single common shared project, which
94
- everybody -- students and all collaborators on this project (your
95
- TAs and other instructors) -- will have < b > write</ b > access to. This
96
- can be useful for collaborative in-class labs, course-wide chat
97
- rooms, and making miscellanous materials available for students to
98
- experiment with together.
99
- </ p >
100
- < p >
101
- When you create the shared project, everybody who has already
102
- created an account is added as a collaborator to the project.
103
- Whenever you re-open this course, any students or collaborators on
104
- the project that contains this course will be added to the shared
105
- project.
106
- </ p >
107
- < p >
108
- After you create the shared project, you should move the shared
109
- project to a members only server or upgrade it in other ways if you
110
- want it to be more stable.
111
- </ p >
112
- </ div >
114
+ < FormattedMessage
115
+ id = "course.shared-project-panel.create_project.message"
116
+ defaultMessage = { `
117
+ <p>
118
+ <i>Optionally</i> create a single common shared project, which
119
+ everybody – students and all collaborators on this project (your
120
+ TAs and other instructors) – will have <b>write</b> access to. This
121
+ can be useful for collaborative in-class labs, course-wide chat
122
+ rooms, and making miscellanous materials available for students to
123
+ experiment with together.
124
+ </p>
125
+ <secondary>
126
+ When you create the shared project, everybody who has already
127
+ created an account is added as a collaborator to the project.
128
+ Whenever you re-open this course, any students or collaborators on
129
+ the project that contains this course will be added to the shared
130
+ project.
131
+ </secondary>
132
+ <secondary>
133
+ After you create the shared project, you should upgrade that project via a license as well.
134
+ </secondary>` }
135
+ values = { icuVals }
136
+ />
113
137
< br />
114
138
< Popconfirm
115
139
title = {
116
140
< div style = { { maxWidth : "400px" } } >
117
- Are you sure you want to create a shared project and add all
118
- students in this course as collaborators?
141
+ < FormattedMessage
142
+ id = "course.shared-project-panel.create_project.confirmation"
143
+ defaultMessage = { `Are you sure you want to create a shared project
144
+ and add all students in this course as collaborators?` }
145
+ />
119
146
</ div >
120
147
}
121
148
onConfirm = { ( ) => {
@@ -125,11 +152,11 @@ export function SharedProjectPanel({
125
152
close ?.( ) ;
126
153
}
127
154
} }
128
- okText = "Create Shared Project"
155
+ okText = { intl . formatMessage ( course . create_shared_project ) }
129
156
cancelText = { < CancelText /> }
130
157
>
131
158
< Button size = { "large" } icon = { < UsergroupAddOutlined /> } >
132
- Create shared project ...
159
+ { intl . formatMessage ( course . create_shared_project ) } ...
133
160
</ Button >
134
161
</ Popconfirm >
135
162
</ div >
0 commit comments