Skip to content

Commit 89bb37b

Browse files
authored
[ui]: UI overhaul + dark theme (#12)
* landing page * fine-tuning * dark theme * add picture to readme
1 parent 6f45911 commit 89bb37b

37 files changed

+820
-443
lines changed

.github/start_screen.png

872 KB
Loading

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# Group Challenge
22

3+
[![Docker](https://github.com/subshell/group-challenge/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/subshell/group-challenge/actions/workflows/docker-publish.yml)
4+
35
An easy-to-use website to create submission-based challenges that will be evaluated together in real-time.
46
Any user is allowed to create challenges with a fixed start and end date while others join and
57
contribute. Currently supported challenges are:
68

79
- 📸 **Photo Challenge**
810

11+
![Start Screen](.github/start_screen.png)
12+
913
## Local development
1014

1115
This project includes pre-configured configuration files to launch the api, frontend, and postgres in VS Code. Alternatively you can start all services with the following commands:
1216

1317
1. **Postgres:** start a postgres db at port `5432`.
1418

1519
```sh
20+
mkdir /tmp/group-challenge-cache
1621
docker-compose up
1722
```
1823

@@ -57,10 +62,10 @@ imgProxy:
5762
5863
### Kubernetes support
5964
60-
The helm chart is available under https://subshell.github.io/helm-charts/
65+
The helm chart is available under https://subshell.github.io/helm-charts-lab/
6166
6267
```sh
63-
helm repo add subshell-public https://subshell.github.io/helm-charts
68+
helm repo add subshell-public https://subshell.github.io/helm-charts-lab
6469
helm install -f gc-values.yaml group-challenge subshell-public/group-challenge
6570
```
6671

api/pkg/group-challenge/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func RunServer(serverConfig config.ServerConfig, challengesConfig config.Challen
113113
},
114114
)
115115

116-
imgCache = ttlcache.New[string, models.Image](
116+
imgCache = ttlcache.New(
117117
ttlcache.WithTTL[string, models.Image](8*time.Hour),
118118
ttlcache.WithLoader[string, models.Image](loader),
119119
ttlcache.WithCapacity[string, models.Image](imagesInMemoryCacheSize),

api/pkg/group-challenge/models/party-model.go

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,17 @@ func (partySubmission *PartySubmission) AddVote(vote *Vote, con *pg.DB) (err err
9797
}
9898

9999
// Select selects the party by its id
100-
func (party *Party) Select(con *pg.DB) (err error) {
100+
func (party *Party) Select(con *pg.DB) error {
101101
// party
102-
err = con.Model(party).Where("id = ?0", party.ID).Select()
102+
err := con.Model(party).Where("id = ?0", party.ID).Select()
103103
if err != nil {
104104
return err
105105
}
106106

107107
// submissions
108-
submissions := []*PartySubmission{}
109-
err = con.Model(&submissions).Column("psubm.*").Join("INNER JOIN parties_submissions psr on psr.submission_id = psubm.id").Where("psr.party_id = ?", party.ID).Select()
110-
if err != nil {
111-
return err
112-
}
113-
party.Submissions = submissions
114-
115-
// votes for each submission
116-
for _, submission := range submissions {
117-
votes := []*Vote{}
118-
err = con.Model(&votes).Where("svote.submission_id = ?", submission.ID).Select()
119-
if err != nil {
120-
return err
121-
}
122-
submission.Votes = votes
123-
}
108+
party.loadPartySubmissions(con)
124109

125-
return
110+
return nil
126111
}
127112

128113
func (submission *PartySubmission) DeleteVotes(con *pg.DB) {
@@ -154,5 +139,31 @@ func GetAllParties(parties *[]*Party, con *pg.DB) error {
154139
return err
155140
}
156141

142+
// submissions
143+
for _, party := range *parties {
144+
party.loadPartySubmissions(con)
145+
}
146+
147+
return nil
148+
}
149+
150+
func (party *Party) loadPartySubmissions(con *pg.DB) error {
151+
submissions := []*PartySubmission{}
152+
err := con.Model(&submissions).Column("psubm.*").Join("INNER JOIN parties_submissions psr on psr.submission_id = psubm.id").Where("psr.party_id = ?", party.ID).Select()
153+
if err != nil {
154+
return err
155+
}
156+
party.Submissions = submissions
157+
158+
// votes for each submission
159+
for _, submission := range submissions {
160+
votes := []*Vote{}
161+
err = con.Model(&votes).Where("svote.submission_id = ?", submission.ID).Select()
162+
if err != nil {
163+
return err
164+
}
165+
submission.Votes = votes
166+
}
167+
157168
return nil
158169
}

0 commit comments

Comments
 (0)