Skip to content

Commit

Permalink
Merge pull request #6 from Oskarowski/dev
Browse files Browse the repository at this point in the history
Dev -> Master
  • Loading branch information
Oskarowski authored Oct 4, 2024
2 parents fa67b80 + ada09c3 commit ac7365c
Show file tree
Hide file tree
Showing 21 changed files with 1,179 additions and 302 deletions.
34 changes: 32 additions & 2 deletions db/queries/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WHERE

-- name: ListGames :many
SELECT
id, grid_size, mines_amount, game_failed, game_won, created_at
id, uuid, grid_size, mines_amount, game_failed, game_won, created_at
FROM
games
ORDER BY
Expand Down Expand Up @@ -62,10 +62,40 @@ FROM
WHERE
uuid IN (sqlc.slice('uuids'));

-- name: GetGamesInfo :one
SELECT
COUNT(*) AS total_games,
COUNT(*) FILTER (WHERE game_won = TRUE) AS won_games,
COUNT(*) FILTER (WHERE game_failed = TRUE AND game_won = FALSE) AS lost_games,
COUNT(*) FILTER (WHERE game_failed = FALSE AND game_won = FALSE) AS not_finished_games
FROM
games;

-- name: GetMovesByGameId :many
SELECT
*
FROM
moves
WHERE
game_id = ?
game_id = ?;

-- name: GetGamesByMonthYearGroupedByDay :many
SELECT
strftime('%d', created_at) AS day,
COUNT(*) AS games_played
FROM games
WHERE created_at >= ? AND created_at < ?
GROUP BY day
ORDER BY day;

-- name: GetGamesPlayedPerGridSize :many
SELECT grid_size, COUNT(*) AS games_played
FROM games
GROUP BY grid_size
ORDER BY grid_size;

-- name: GetMinesPopularity :many
SELECT mines_amount, COUNT(*) AS mines_count
FROM games
GROUP BY mines_amount
ORDER BY mines_amount;
1 change: 1 addition & 0 deletions db/sqlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ sql:
schema: "./migrations"
gen:
go:
initialisms: []
package: "db"
out: "../internal/db"
Binary file added dist/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions dist/load-spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 32 additions & 4 deletions dist/main.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
.mine-field {
background-color: rgba(0, 0, 0, 0.088);
transition: background-color 0.2s ease;
background-color: rgba(0, 0, 0, 0.088);
transition: background-color 0.2s ease;
cursor: pointer;
font-weight: bold;
}

.cell-revealed {
background-color: burlywood;
background-color: burlywood;
}

.mine-field:not(.cell-revealed):not(.cell-flagged):hover {
background-color: rgb(235, 219, 0);
background-color: rgb(235, 219, 0);
}

.mine-field:not(.cell-revealed):not(.cell-flagged):hover {
background-color: rgb(235, 219, 0);
}

[popover] {
transition:
opacity 0.2s,
transform 0.2s,
display 0.2s allow-discrete;

opacity: 0;
transform: translateY(3rem);

&:popover-open {
opacity: 1;
transform: none;

@starting-style {
& {
opacity: 0;
transform: translateY(-1rem);
}
}
}
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22.1

require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-echarts/go-echarts/v2 v2.4.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.3.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/go-echarts/go-echarts/v2 v2.4.2 h1:1FC3tGzsLSgdeO4Ltc3OAtcIiRomfEKxKX9oocIL68g=
github.com/go-echarts/go-echarts/v2 v2.4.2/go.mod h1:56YlvzhW/a+du15f3S2qUGNDfKnFOeJSThBIrVFHDtI=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
Expand Down
Loading

0 comments on commit ac7365c

Please sign in to comment.