Skip to content

Commit d628971

Browse files
authored
Merge pull request #135 from c4dt/42
EPFL corporate design
2 parents 818aeb5 + 56fbba5 commit d628971

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+292
-205
lines changed

contracts/evoting/types/ballots.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ func (b *Ballot) Equal(other Ballot) bool {
255255

256256
// Title contains the titles in different languages.
257257
type Title struct {
258-
En string
259-
Fr string
260-
De string
258+
En string
259+
Fr string
260+
De string
261+
URL string
261262
}
262263

263264
// Hint contains explanations in different languages.

contracts/evoting/types/ballots_test.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,29 @@ func TestBallot_Unmarshal(t *testing.T) {
5656

5757
Selects: []Select{{
5858
ID: decodedQuestionID(1),
59-
Title: Title{En: "", Fr: "", De: ""},
59+
Title: Title{En: "", Fr: "", De: "", URL: ""},
6060
MaxN: 2,
6161
MinN: 2,
6262
Choices: make([]Choice, 3),
6363
}, {
6464
ID: decodedQuestionID(2),
65-
Title: Title{En: "", Fr: "", De: ""},
65+
Title: Title{En: "", Fr: "", De: "", URL: ""},
6666
MaxN: 3,
6767
MinN: 3,
6868
Choices: make([]Choice, 5),
6969
}},
7070

7171
Ranks: []Rank{{
7272
ID: decodedQuestionID(3),
73-
Title: Title{En: "", Fr: "", De: ""},
73+
Title: Title{En: "", Fr: "", De: "", URL: ""},
7474
MaxN: 4,
7575
MinN: 0,
7676
Choices: make([]Choice, 4),
7777
}},
7878

7979
Texts: []Text{{
8080
ID: decodedQuestionID(4),
81-
Title: Title{En: "", Fr: "", De: ""},
81+
Title: Title{En: "", Fr: "", De: "", URL: ""},
8282
MaxN: 2,
8383
MinN: 2,
8484
MaxLength: 10,
@@ -305,7 +305,7 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
305305
subject := Subject{
306306
Subjects: []Subject{{
307307
ID: "",
308-
Title: Title{En: "", Fr: "", De: ""},
308+
Title: Title{En: "", Fr: "", De: "", URL: ""},
309309
Order: nil,
310310
Subjects: []Subject{},
311311
Selects: []Select{},
@@ -315,37 +315,37 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
315315

316316
Selects: []Select{{
317317
ID: encodedQuestionID(1),
318-
Title: Title{En: "", Fr: "", De: ""},
318+
Title: Title{En: "", Fr: "", De: "", URL: ""},
319319
MaxN: 3,
320320
MinN: 0,
321321
Choices: make([]Choice, 3),
322322
}, {
323323
ID: encodedQuestionID(2),
324-
Title: Title{En: "", Fr: "", De: ""},
324+
Title: Title{En: "", Fr: "", De: "", URL: ""},
325325
MaxN: 5,
326326
MinN: 0,
327327
Choices: make([]Choice, 5),
328328
}},
329329

330330
Ranks: []Rank{{
331331
ID: encodedQuestionID(3),
332-
Title: Title{En: "", Fr: "", De: ""},
332+
Title: Title{En: "", Fr: "", De: "", URL: ""},
333333
MaxN: 4,
334334
MinN: 0,
335335
Choices: make([]Choice, 4),
336336
}},
337337

338338
Texts: []Text{{
339339
ID: encodedQuestionID(4),
340-
Title: Title{En: "", Fr: "", De: ""},
340+
Title: Title{En: "", Fr: "", De: "", URL: ""},
341341
MaxN: 2,
342342
MinN: 0,
343343
MaxLength: 10,
344344
Regex: "",
345345
Choices: make([]Choice, 2),
346346
}, {
347347
ID: encodedQuestionID(5),
348-
Title: Title{En: "", Fr: "", De: ""},
348+
Title: Title{En: "", Fr: "", De: "", URL: ""},
349349
MaxN: 1,
350350
MinN: 0,
351351
MaxLength: 10,
@@ -355,7 +355,7 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
355355
}
356356

357357
conf := Configuration{
358-
Title: Title{En: "", Fr: "", De: ""},
358+
Title: Title{En: "", Fr: "", De: "", URL: ""},
359359
Scaffold: []Subject{subject},
360360
}
361361

@@ -368,7 +368,7 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
368368
func TestSubject_IsValid(t *testing.T) {
369369
mainSubject := &Subject{
370370
ID: ID(base64.StdEncoding.EncodeToString([]byte("S1"))),
371-
Title: Title{En: "", Fr: "", De: ""},
371+
Title: Title{En: "", Fr: "", De: "", URL: ""},
372372
Order: []ID{},
373373
Subjects: []Subject{},
374374
Selects: []Select{},
@@ -378,7 +378,7 @@ func TestSubject_IsValid(t *testing.T) {
378378

379379
subSubject := &Subject{
380380
ID: ID(base64.StdEncoding.EncodeToString([]byte("S2"))),
381-
Title: Title{En: "", Fr: "", De: ""},
381+
Title: Title{En: "", Fr: "", De: "", URL: ""},
382382
Order: []ID{},
383383
Subjects: []Subject{},
384384
Selects: []Select{},
@@ -387,7 +387,7 @@ func TestSubject_IsValid(t *testing.T) {
387387
}
388388

389389
configuration := Configuration{
390-
Title: Title{En: "", Fr: "", De: ""},
390+
Title: Title{En: "", Fr: "", De: "", URL: ""},
391391
Scaffold: []Subject{*mainSubject, *subSubject},
392392
}
393393

@@ -400,15 +400,15 @@ func TestSubject_IsValid(t *testing.T) {
400400

401401
mainSubject.Selects = []Select{{
402402
ID: encodedQuestionID(1),
403-
Title: Title{En: "", Fr: "", De: ""},
403+
Title: Title{En: "", Fr: "", De: "", URL: ""},
404404
MaxN: 0,
405405
MinN: 0,
406406
Choices: make([]Choice, 0),
407407
}}
408408

409409
mainSubject.Ranks = []Rank{{
410410
ID: encodedQuestionID(1),
411-
Title: Title{En: "", Fr: "", De: ""},
411+
Title: Title{En: "", Fr: "", De: "", URL: ""},
412412
MaxN: 0,
413413
MinN: 0,
414414
Choices: make([]Choice, 0),
@@ -423,7 +423,7 @@ func TestSubject_IsValid(t *testing.T) {
423423

424424
mainSubject.Ranks[0] = Rank{
425425
ID: encodedQuestionID(2),
426-
Title: Title{En: "", Fr: "", De: ""},
426+
Title: Title{En: "", Fr: "", De: "", URL: ""},
427427
MaxN: 0,
428428
MinN: 2,
429429
Choices: make([]Choice, 0),
@@ -439,7 +439,7 @@ func TestSubject_IsValid(t *testing.T) {
439439
mainSubject.Ranks = []Rank{}
440440
mainSubject.Selects[0] = Select{
441441
ID: encodedQuestionID(1),
442-
Title: Title{En: "", Fr: "", De: ""},
442+
Title: Title{En: "", Fr: "", De: "", URL: ""},
443443
MaxN: 1,
444444
MinN: 0,
445445
Choices: make([]Choice, 0),
@@ -455,7 +455,7 @@ func TestSubject_IsValid(t *testing.T) {
455455
mainSubject.Selects = []Select{}
456456
mainSubject.Texts = []Text{{
457457
ID: encodedQuestionID(3),
458-
Title: Title{En: "", Fr: "", De: ""},
458+
Title: Title{En: "", Fr: "", De: "", URL: ""},
459459
MaxN: 2,
460460
MinN: 4,
461461
MaxLength: 0,

integration/performance_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func customVotesScenario(b *testing.B, stuffing bool) {
7777
fmt.Println("Creating form")
7878

7979
// ##### CREATE FORM #####
80-
formID, err := createFormNChunks(m, types.Title{En: "Three votes form", Fr: "", De: ""}, adminID, numChunksPerBallot)
80+
formID, err := createFormNChunks(m, types.Title{En: "Three votes form", Fr: "", De: "", URL: ""}, adminID, numChunksPerBallot)
8181
require.NoError(b, err)
8282

8383
time.Sleep(time.Millisecond * 1000)
@@ -198,14 +198,14 @@ func createFormNChunks(m txManager, title types.Title, admin string, numChunks i
198198
Scaffold: []types.Subject{
199199
{
200200
ID: "aa",
201-
Title: types.Title{En: "subject1", Fr: "", De: ""},
201+
Title: types.Title{En: "subject1", Fr: "", De: "", URL: ""},
202202
Order: nil,
203203
Subjects: nil,
204204
Selects: nil,
205205
Ranks: []types.Rank{},
206206
Texts: []types.Text{{
207207
ID: "bb",
208-
Title: types.Title{En: "Enter favorite snack", Fr: "", De: ""},
208+
Title: types.Title{En: "Enter favorite snack", Fr: "", De: "", URL: ""},
209209
MaxN: 1,
210210
MinN: 0,
211211
MaxLength: uint(base64.StdEncoding.DecodedLen(textSize)),

internal/testing/fake/election.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ func NewForm(ctx serde.Context, snapshot store.Snapshot, formID string) (types.F
2121
form := types.Form{
2222
Configuration: types.Configuration{
2323
Title: types.Title{
24-
En: "dummyTitle",
25-
Fr: "",
26-
De: "",
24+
En: "dummyTitle",
25+
Fr: "",
26+
De: "",
27+
URL: "",
2728
},
2829
},
2930
FormID: formID,
@@ -75,17 +76,17 @@ func NewKCPointsMarshalled(k int) ([]kyber.Point, []kyber.Point, kyber.Point) {
7576

7677
// BasicConfiguration returns a basic form configuration
7778
var BasicConfiguration = types.Configuration{
78-
Title: types.Title{En: "formTitle", Fr: "", De: ""},
79+
Title: types.Title{En: "formTitle", Fr: "", De: "", URL: ""},
7980
Scaffold: []types.Subject{
8081
{
8182
ID: "aa",
82-
Title: types.Title{En: "subject1", Fr: "", De: ""},
83+
Title: types.Title{En: "subject1", Fr: "", De: "", URL: ""},
8384
Order: nil,
8485
Subjects: nil,
8586
Selects: []types.Select{
8687
{
8788
ID: "bb",
88-
Title: types.Title{En: "Select your favorite snacks", Fr: "", De: ""},
89+
Title: types.Title{En: "Select your favorite snacks", Fr: "", De: "", URL: ""},
8990
MaxN: 3,
9091
MinN: 0,
9192
Choices: []types.Choice{{Choice: "snickers", URL: ""}, {Choice: "mars", URL: ""}, {Choice: "vodka", URL: ""}, {Choice: "babibel", URL: ""}},
@@ -96,15 +97,15 @@ var BasicConfiguration = types.Configuration{
9697
},
9798
{
9899
ID: "dd",
99-
Title: types.Title{En: "subject2", Fr: "", De: ""},
100+
Title: types.Title{En: "subject2", Fr: "", De: "", URL: ""},
100101
Order: nil,
101102
Subjects: nil,
102103
Selects: nil,
103104
Ranks: nil,
104105
Texts: []types.Text{
105106
{
106107
ID: "ee",
107-
Title: types.Title{En: "dissertation", Fr: "", De: ""},
108+
Title: types.Title{En: "dissertation", Fr: "", De: "", URL: ""},
108109
MaxN: 1,
109110
MinN: 1,
110111
MaxLength: 3,
Loading

web/frontend/src/components/buttons/DownloadButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const DownloadButton: FC<DownloadButtonProps> = ({ exportData, children }) => {
1010
return (
1111
<button
1212
type="button"
13-
className="flex my-2 mx-2 items-center px-4 py-2 border rounded-md text-sm font-medium hover:text-indigo-500"
13+
className="flex my-2 mx-2 items-center px-4 py-2 border rounded-md text-sm font-medium hover:text-[#ff0000]"
1414
onClick={exportData}>
1515
<CloudDownloadIcon className="-ml-1 mr-2 h-5 w-5" aria-hidden="true" />
1616
{children}

web/frontend/src/components/modal/ConfirmModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const ConfirmModal: FC<ConfirmModalProps> = ({
8383
</button>
8484
<button
8585
type="button"
86-
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
86+
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#ff0000] sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
8787
onClick={closeModal}
8888
ref={cancelButtonRef}>
8989
{t('no')}

web/frontend/src/components/modal/RedirectToModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const RedirectToModal: FC<RedirectToModalProps> = ({
7373
<div className="mt-4">
7474
<button
7575
type="button"
76-
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-500 border border-transparent rounded-md hover:bg-indigo-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-indigo-500"
76+
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-[#ff0000] border border-transparent rounded-md hover:bg-[#ff0000] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[#ff0000]"
7777
onClick={closeModal}>
7878
{buttonRightText}
7979
</button>

web/frontend/src/components/utils/FillFormInfo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const useFillFormInfo = (formData: FormInfo) => {
5252

5353
const useFillLightFormInfo = (formData: LightFormInfo) => {
5454
const [id, setId] = useState<ID>('');
55-
const [title, setTitle] = useState<Title>({ En: '', Fr: '', De: '' });
55+
const [title, setTitle] = useState<Title>({ En: '', Fr: '', De: '', URL: '' });
5656
const [status, setStatus] = useState<Status>(null);
5757
const [pubKey, setPubKey] = useState<string>('');
5858

web/frontend/src/index.css

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
body {
66
margin: 0;
7-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
8-
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
7+
font-family: Arial, sans-serif;
98
-webkit-font-smoothing: antialiased;
109
-moz-osx-font-smoothing: grayscale;
1110
}
1211

1312
code {
14-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
13+
font-family: Arial, monospace;
1514
}

web/frontend/src/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const Loading: FC = () => {
121121
<div className="text-center pb-2">
122122
<svg
123123
role="status"
124-
className="inline w-16 h-16 mr-2 text-gray-200 animate-spin dark:text-gray-400 fill-indigo-600"
124+
className="inline w-16 h-16 mr-2 text-gray-200 animate-spin dark:text-gray-400 fill-[#ff0000]"
125125
viewBox="0 0 100 101"
126126
fill="none"
127127
xmlns="http://www.w3.org/2000/svg">

web/frontend/src/layout/App.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.App {
2-
font-family: sans-serif;
2+
font-family: Arial, sans-serif;
33
color: rgb(71, 71, 71);
44
background-color: white;
55
position: relative;

web/frontend/src/layout/ClientError.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function ClientError({
2020
<div className="bg-white min-h-full font-sans px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8">
2121
<div className="max-w-max mx-auto">
2222
<main className="sm:flex">
23-
<p className="text-4xl font-extrabold text-indigo-600 sm:text-5xl">{statusCode}</p>
23+
<p className="text-4xl font-extrabold text-[#ff0000] sm:text-5xl">{statusCode}</p>
2424
<div className="sm:ml-6">
2525
<div className="sm:border-l sm:border-gray-200 sm:pl-6">
2626
<h1 className="text-4xl font-extrabold text-gray-900 tracking-tight sm:text-5xl">
@@ -35,15 +35,15 @@ export default function ClientError({
3535
{statusCode === 401 && (
3636
<button
3737
id="login-button"
38-
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
38+
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-[#ff0000] hover:bg-[#b51f1f] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#ff0000]"
3939
onClick={() => handleLogin(fctx)}>
4040
{t('login')}
4141
</button>
4242
)}
4343
{statusCode !== 401 && (
4444
<Link
4545
to={ROUTE_HOME}
46-
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
46+
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-[#ff0000] hover:bg-[#b51f1f] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#ff0000]">
4747
{t('goHome')}
4848
</Link>
4949
)}

web/frontend/src/layout/Flash.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Flash = () => {
1717
<div
1818
key={msg.id}
1919
className={`relative
20-
${msg.getLevel() === FlashLevel.Info && 'bg-indigo-500'}
20+
${msg.getLevel() === FlashLevel.Info && 'bg-[#ff0000]'}
2121
${msg.getLevel() === FlashLevel.Warning && 'bg-orange-500'}
2222
${msg.getLevel() === FlashLevel.Error && 'bg-red-500'}`}>
2323
<div
@@ -33,9 +33,7 @@ const Flash = () => {
3333
<button
3434
type="button"
3535
className={`ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 p-1.5 inline-flex h-8 w-8
36-
${
37-
msg.getLevel() === FlashLevel.Info && 'focus:ring-indigo-400 hover:bg-indigo-600'
38-
}
36+
${msg.getLevel() === FlashLevel.Info && 'focus:ring-[#ff0000] hover:bg-[#ff0000]'}
3937
${
4038
msg.getLevel() === FlashLevel.Warning &&
4139
'focus:ring-orange-400 hover:bg-orange-600'

0 commit comments

Comments
 (0)