Skip to content

Commit

Permalink
First draft of imported/rejected suggestions styling #1669
Browse files Browse the repository at this point in the history
  • Loading branch information
verheyenkoen committed Sep 12, 2024
1 parent 57249a6 commit cbe12b3
Show file tree
Hide file tree
Showing 14 changed files with 426 additions and 253 deletions.
20 changes: 6 additions & 14 deletions assets/ugent/scss/components/_c-button-toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,23 @@
.c-button-toolbar {
align-items: center;
display: flex;
gap: 1.2rem;

.btn {
margin: 0.4rem 1.2rem 0.4rem 0;
}

.btn:last-child {
margin-right: 0;
margin: 0.4rem 0;
}
}

.c-button-toolbar--wide-spacing {
.btn {
margin: 0.4rem 1.6rem 0.4rem 0;
}

.btn:last-child,
.dropdown:last-child .btn {
margin-right: 0;
}
gap: 1.6rem;
}

.c-button-toolbar--vertical {
flex-direction: column;
align-items: flex-end;
gap: 0.4rem;

.btn {
margin: 0.4rem 0.4rem 0.8rem 0.4rem;
margin: 0.4rem;
}
}
9 changes: 5 additions & 4 deletions db/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ RETURNING id;
-- name: GetCandidateRecords :many
SELECT *, count(*) OVER () AS total
FROM candidate_records
WHERE status = 'new'
WHERE (status = 'new' OR EXTRACT(DAY FROM (current_timestamp - date_created)) <= 90)
ORDER BY date_created ASC
LIMIT $1
OFFSET $2;
LIMIT sqlc.arg('limit')
OFFSET sqlc.arg('offset');

-- name: GetCandidateRecordsByPersonID :many
SELECT *, count(*) OVER () AS total
FROM candidate_records
WHERE status = 'new' AND (metadata->'author' @> sqlc.arg(query)::jsonb OR metadata->'supervisor' @> sqlc.arg(query)::jsonb)
WHERE (status = 'new' OR (sqlc.arg('new_only')::bool = 0::bool AND EXTRACT(DAY FROM (current_timestamp - date_created)) <= 90))
AND (metadata->'author' @> sqlc.arg(query)::jsonb OR metadata->'supervisor' @> sqlc.arg(query)::jsonb)
ORDER BY date_created ASC
LIMIT sqlc.arg('limit')
OFFSET sqlc.arg('offset');
Expand Down
31 changes: 19 additions & 12 deletions db/query.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion handlers/candidaterecords/candidate_records.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func CandidateRecords(w http.ResponseWriter, r *http.Request) {
if c.UserRole == "curator" {
total, recs, err = c.Repo.GetCandidateRecords(r.Context(), searchArgs.Offset(), searchArgs.Limit())
} else {
total, recs, err = c.Repo.GetCandidateRecordsByPersonID(r.Context(), c.User.ID, searchArgs.Offset(), searchArgs.Limit())
total, recs, err = c.Repo.GetCandidateRecordsByPersonID(r.Context(), c.User.ID, searchArgs.Offset(), searchArgs.Limit(), false)
}

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion handlers/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func CandidateRecords(w http.ResponseWriter, r *http.Request) {
var err error

if c.FlagCandidateRecords() {
total, recs, err = c.Repo.GetCandidateRecordsByPersonID(r.Context(), c.User.ID, 0, 5)
total, recs, err = c.Repo.GetCandidateRecordsByPersonID(r.Context(), c.User.ID, 0, 4, true)
}

if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions repositories/candidate_records.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ func (r *Repo) HasCandidateRecords(ctx context.Context) (bool, error) {
return exists, nil
}

func (r *Repo) GetCandidateRecordsByPersonID(ctx context.Context, personID string, start int, limit int) (int, []*models.CandidateRecord, error) {
func (r *Repo) GetCandidateRecordsByPersonID(ctx context.Context, personID string, start int, limit int, newOnly bool) (int, []*models.CandidateRecord, error) {
query, _ := json.Marshal([]struct {
PersonID string `json:"person_id"`
}{{PersonID: personID}})

rows, err := r.queries.GetCandidateRecordsByPersonID(ctx, db.GetCandidateRecordsByPersonIDParams{
Query: query,
Limit: int32(limit),
Offset: int32(start),
Query: query,
Limit: int32(limit),
Offset: int32(start),
NewOnly: newOnly,
})
if err != nil {
return 0, nil, err
Expand Down
6 changes: 3 additions & 3 deletions static/css/app-LFJJYNQC.css → static/css/app-W2NYBKTQ.css

Large diffs are not rendered by default.

File renamed without changes.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"/js/app.js": "/static/js/app-B5CCDP65.js",
"/fonts/icon-font.woff2": "/static/fonts/icon-font-MKUEJCPC.woff2",
"/fonts/icon-font.woff": "/static/fonts/icon-font-4S7CKSGJ.woff",
"/css/app.css": "/static/css/app-LFJJYNQC.css",
"/css/app.css": "/static/css/app-W2NYBKTQ.css",
"/images/plato-logo.svg": "/static/images/plato-logo-EKBIWHHI.svg",
"/images/book-illustration.svg": "/static/images/book-illustration-XEGTEPBW.svg",
"/images/universiteitsbibliotheek.svg": "/static/images/universiteitsbibliotheek-G2PUY5IZ.svg",
Expand Down
2 changes: 1 addition & 1 deletion views/candidaterecord/list.templ
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ templ List(c *ctx.Ctx, searchArgs *models.SearchArgs, searchHits *models.SearchH
<div class="card-body w-100 p-0">
<ul class="list-group list-group-flush">
for _, rec := range recs {
<li class="list-group-item bg-transparent">
<li class={ "list-group-item", "bg-transparent", templ.KV("opacity-75", rec.Status != "new") }>
@Summary(c, rec)
</li>
}
Expand Down
32 changes: 25 additions & 7 deletions views/candidaterecord/list_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cbe12b3

Please sign in to comment.