Skip to content

Commit

Permalink
Merge pull request #135 from c4dt/42
Browse files Browse the repository at this point in the history
EPFL corporate design
  • Loading branch information
PascalinDe authored Mar 6, 2024
2 parents 818aeb5 + 56fbba5 commit d628971
Show file tree
Hide file tree
Showing 69 changed files with 292 additions and 205 deletions.
7 changes: 4 additions & 3 deletions contracts/evoting/types/ballots.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,10 @@ func (b *Ballot) Equal(other Ballot) bool {

// Title contains the titles in different languages.
type Title struct {
En string
Fr string
De string
En string
Fr string
De string
URL string
}

// Hint contains explanations in different languages.
Expand Down
38 changes: 19 additions & 19 deletions contracts/evoting/types/ballots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,29 @@ func TestBallot_Unmarshal(t *testing.T) {

Selects: []Select{{
ID: decodedQuestionID(1),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 2,
MinN: 2,
Choices: make([]Choice, 3),
}, {
ID: decodedQuestionID(2),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 3,
MinN: 3,
Choices: make([]Choice, 5),
}},

Ranks: []Rank{{
ID: decodedQuestionID(3),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 4,
MinN: 0,
Choices: make([]Choice, 4),
}},

Texts: []Text{{
ID: decodedQuestionID(4),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 2,
MinN: 2,
MaxLength: 10,
Expand Down Expand Up @@ -305,7 +305,7 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
subject := Subject{
Subjects: []Subject{{
ID: "",
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
Order: nil,
Subjects: []Subject{},
Selects: []Select{},
Expand All @@ -315,37 +315,37 @@ func TestSubject_MaxEncodedSize(t *testing.T) {

Selects: []Select{{
ID: encodedQuestionID(1),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 3,
MinN: 0,
Choices: make([]Choice, 3),
}, {
ID: encodedQuestionID(2),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 5,
MinN: 0,
Choices: make([]Choice, 5),
}},

Ranks: []Rank{{
ID: encodedQuestionID(3),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 4,
MinN: 0,
Choices: make([]Choice, 4),
}},

Texts: []Text{{
ID: encodedQuestionID(4),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 2,
MinN: 0,
MaxLength: 10,
Regex: "",
Choices: make([]Choice, 2),
}, {
ID: encodedQuestionID(5),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 1,
MinN: 0,
MaxLength: 10,
Expand All @@ -355,7 +355,7 @@ func TestSubject_MaxEncodedSize(t *testing.T) {
}

conf := Configuration{
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
Scaffold: []Subject{subject},
}

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

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

configuration := Configuration{
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
Scaffold: []Subject{*mainSubject, *subSubject},
}

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

mainSubject.Selects = []Select{{
ID: encodedQuestionID(1),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 0,
MinN: 0,
Choices: make([]Choice, 0),
}}

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

mainSubject.Ranks[0] = Rank{
ID: encodedQuestionID(2),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 0,
MinN: 2,
Choices: make([]Choice, 0),
Expand All @@ -439,7 +439,7 @@ func TestSubject_IsValid(t *testing.T) {
mainSubject.Ranks = []Rank{}
mainSubject.Selects[0] = Select{
ID: encodedQuestionID(1),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 1,
MinN: 0,
Choices: make([]Choice, 0),
Expand All @@ -455,7 +455,7 @@ func TestSubject_IsValid(t *testing.T) {
mainSubject.Selects = []Select{}
mainSubject.Texts = []Text{{
ID: encodedQuestionID(3),
Title: Title{En: "", Fr: "", De: ""},
Title: Title{En: "", Fr: "", De: "", URL: ""},
MaxN: 2,
MinN: 4,
MaxLength: 0,
Expand Down
6 changes: 3 additions & 3 deletions integration/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func customVotesScenario(b *testing.B, stuffing bool) {
fmt.Println("Creating form")

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

time.Sleep(time.Millisecond * 1000)
Expand Down Expand Up @@ -198,14 +198,14 @@ func createFormNChunks(m txManager, title types.Title, admin string, numChunks i
Scaffold: []types.Subject{
{
ID: "aa",
Title: types.Title{En: "subject1", Fr: "", De: ""},
Title: types.Title{En: "subject1", Fr: "", De: "", URL: ""},
Order: nil,
Subjects: nil,
Selects: nil,
Ranks: []types.Rank{},
Texts: []types.Text{{
ID: "bb",
Title: types.Title{En: "Enter favorite snack", Fr: "", De: ""},
Title: types.Title{En: "Enter favorite snack", Fr: "", De: "", URL: ""},
MaxN: 1,
MinN: 0,
MaxLength: uint(base64.StdEncoding.DecodedLen(textSize)),
Expand Down
17 changes: 9 additions & 8 deletions internal/testing/fake/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ func NewForm(ctx serde.Context, snapshot store.Snapshot, formID string) (types.F
form := types.Form{
Configuration: types.Configuration{
Title: types.Title{
En: "dummyTitle",
Fr: "",
De: "",
En: "dummyTitle",
Fr: "",
De: "",
URL: "",
},
},
FormID: formID,
Expand Down Expand Up @@ -75,17 +76,17 @@ func NewKCPointsMarshalled(k int) ([]kyber.Point, []kyber.Point, kyber.Point) {

// BasicConfiguration returns a basic form configuration
var BasicConfiguration = types.Configuration{
Title: types.Title{En: "formTitle", Fr: "", De: ""},
Title: types.Title{En: "formTitle", Fr: "", De: "", URL: ""},
Scaffold: []types.Subject{
{
ID: "aa",
Title: types.Title{En: "subject1", Fr: "", De: ""},
Title: types.Title{En: "subject1", Fr: "", De: "", URL: ""},
Order: nil,
Subjects: nil,
Selects: []types.Select{
{
ID: "bb",
Title: types.Title{En: "Select your favorite snacks", Fr: "", De: ""},
Title: types.Title{En: "Select your favorite snacks", Fr: "", De: "", URL: ""},
MaxN: 3,
MinN: 0,
Choices: []types.Choice{{Choice: "snickers", URL: ""}, {Choice: "mars", URL: ""}, {Choice: "vodka", URL: ""}, {Choice: "babibel", URL: ""}},
Expand All @@ -96,15 +97,15 @@ var BasicConfiguration = types.Configuration{
},
{
ID: "dd",
Title: types.Title{En: "subject2", Fr: "", De: ""},
Title: types.Title{En: "subject2", Fr: "", De: "", URL: ""},
Order: nil,
Subjects: nil,
Selects: nil,
Ranks: nil,
Texts: []types.Text{
{
ID: "ee",
Title: types.Title{En: "dissertation", Fr: "", De: ""},
Title: types.Title{En: "dissertation", Fr: "", De: "", URL: ""},
MaxN: 1,
MinN: 1,
MaxLength: 3,
Expand Down
21 changes: 21 additions & 0 deletions web/frontend/src/assets/EPFL_Logo_184X53.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion web/frontend/src/components/buttons/DownloadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DownloadButton: FC<DownloadButtonProps> = ({ exportData, children }) => {
return (
<button
type="button"
className="flex my-2 mx-2 items-center px-4 py-2 border rounded-md text-sm font-medium hover:text-indigo-500"
className="flex my-2 mx-2 items-center px-4 py-2 border rounded-md text-sm font-medium hover:text-[#ff0000]"
onClick={exportData}>
<CloudDownloadIcon className="-ml-1 mr-2 h-5 w-5" aria-hidden="true" />
{children}
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/src/components/modal/ConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ConfirmModal: FC<ConfirmModalProps> = ({
</button>
<button
type="button"
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"
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"
onClick={closeModal}
ref={cancelButtonRef}>
{t('no')}
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/src/components/modal/RedirectToModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const RedirectToModal: FC<RedirectToModalProps> = ({
<div className="mt-4">
<button
type="button"
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"
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]"
onClick={closeModal}>
{buttonRightText}
</button>
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/src/components/utils/FillFormInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const useFillFormInfo = (formData: FormInfo) => {

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

Expand Down
5 changes: 2 additions & 3 deletions web/frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-family: Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
font-family: Arial, monospace;
}
2 changes: 1 addition & 1 deletion web/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Loading: FC = () => {
<div className="text-center pb-2">
<svg
role="status"
className="inline w-16 h-16 mr-2 text-gray-200 animate-spin dark:text-gray-400 fill-indigo-600"
className="inline w-16 h-16 mr-2 text-gray-200 animate-spin dark:text-gray-400 fill-[#ff0000]"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg">
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/src/layout/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.App {
font-family: sans-serif;
font-family: Arial, sans-serif;
color: rgb(71, 71, 71);
background-color: white;
position: relative;
Expand Down
6 changes: 3 additions & 3 deletions web/frontend/src/layout/ClientError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ClientError({
<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">
<div className="max-w-max mx-auto">
<main className="sm:flex">
<p className="text-4xl font-extrabold text-indigo-600 sm:text-5xl">{statusCode}</p>
<p className="text-4xl font-extrabold text-[#ff0000] sm:text-5xl">{statusCode}</p>
<div className="sm:ml-6">
<div className="sm:border-l sm:border-gray-200 sm:pl-6">
<h1 className="text-4xl font-extrabold text-gray-900 tracking-tight sm:text-5xl">
Expand All @@ -35,15 +35,15 @@ export default function ClientError({
{statusCode === 401 && (
<button
id="login-button"
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"
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]"
onClick={() => handleLogin(fctx)}>
{t('login')}
</button>
)}
{statusCode !== 401 && (
<Link
to={ROUTE_HOME}
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">
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]">
{t('goHome')}
</Link>
)}
Expand Down
6 changes: 2 additions & 4 deletions web/frontend/src/layout/Flash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Flash = () => {
<div
key={msg.id}
className={`relative
${msg.getLevel() === FlashLevel.Info && 'bg-indigo-500'}
${msg.getLevel() === FlashLevel.Info && 'bg-[#ff0000]'}
${msg.getLevel() === FlashLevel.Warning && 'bg-orange-500'}
${msg.getLevel() === FlashLevel.Error && 'bg-red-500'}`}>
<div
Expand All @@ -33,9 +33,7 @@ const Flash = () => {
<button
type="button"
className={`ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 p-1.5 inline-flex h-8 w-8
${
msg.getLevel() === FlashLevel.Info && 'focus:ring-indigo-400 hover:bg-indigo-600'
}
${msg.getLevel() === FlashLevel.Info && 'focus:ring-[#ff0000] hover:bg-[#ff0000]'}
${
msg.getLevel() === FlashLevel.Warning &&
'focus:ring-orange-400 hover:bg-orange-600'
Expand Down
Loading

0 comments on commit d628971

Please sign in to comment.