diff --git a/cmd/docs/docs.go b/cmd/docs/docs.go index 848b952..c59c548 100644 --- a/cmd/docs/docs.go +++ b/cmd/docs/docs.go @@ -23,6 +23,385 @@ var doc = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/api/v1/statistics/games/last-played": { + "get": { + "description": "Returns the most recently played games", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get last played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/least-played": { + "get": { + "description": "Returns the top N least played games with their songs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get least played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/most-played": { + "get": { + "description": "Returns the top N most played games with their songs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get most played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/never-played": { + "get": { + "description": "Returns all games that have never been played (times_played = 0)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get never played games", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/oldest-played": { + "get": { + "description": "Returns the least recently played games (that have been played at least once)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get oldest played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/songs/least-played": { + "get": { + "description": "Returns the top N least played songs with their game info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get least played songs", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/songs/most-played": { + "get": { + "description": "Returns the top N most played songs with their game info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get most played songs", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/summary": { + "get": { + "description": "Returns overall statistics about the music library", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get statistics summary", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/backend.StatisticsSummary" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, "/api/v1/token": { "post": { "description": "Returns a new session token for API access", @@ -455,7 +834,7 @@ var doc = `{ "tags": [ "music" ], - "summary": "Get all games", + "summary": "Get all soundtracks", "responses": { "200": { "description": "OK", @@ -488,7 +867,7 @@ var doc = `{ "tags": [ "music" ], - "summary": "Get all games random", + "summary": "Get all soundtracks random", "responses": { "200": { "description": "OK", @@ -828,10 +1207,10 @@ var doc = `{ "tags": [ "sync" ], - "summary": "Sync games with only changes", + "summary": "Sync soundtracks with only changes", "responses": { "200": { - "description": "Start syncing games", + "description": "Start syncing soundtracks", "schema": { "type": "string" } @@ -860,7 +1239,7 @@ var doc = `{ "summary": "Sync all games fully", "responses": { "200": { - "description": "Start syncing games full", + "description": "Start syncing soundtracks full", "schema": { "type": "string" } @@ -910,10 +1289,10 @@ var doc = `{ "tags": [ "sync" ], - "summary": "Reset games database", + "summary": "Reset soundtracks database", "responses": { "200": { - "description": "Games and songs are deleted from the database", + "description": "Soundtracks and songs are deleted from the database", "schema": { "type": "string" } @@ -990,6 +1369,78 @@ var doc = `{ } }, "definitions": { + "backend.GameWithSongs": { + "type": "object", + "properties": { + "game_id": { + "type": "integer" + }, + "game_last_played": { + "type": "string" + }, + "game_name": { + "type": "string" + }, + "game_played": { + "type": "integer" + }, + "songs": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + } + }, + "backend.SongInfoForStats": { + "type": "object", + "properties": { + "file_name": { + "type": "string" + }, + "game_id": { + "type": "integer" + }, + "game_name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "song_name": { + "type": "string" + }, + "times_played": { + "type": "integer" + } + } + }, + "backend.StatisticsSummary": { + "type": "object", + "properties": { + "avg_game_plays": { + "type": "number" + }, + "max_game_plays": { + "type": "integer" + }, + "min_game_plays": { + "type": "integer" + }, + "never_played_games": { + "type": "integer" + }, + "played_games": { + "type": "integer" + }, + "total_game_plays": { + "type": "integer" + }, + "total_games": { + "type": "integer" + } + } + }, "backend.VersionData": { "type": "object", "properties": { diff --git a/cmd/docs/swagger.json b/cmd/docs/swagger.json index cde977f..e283757 100644 --- a/cmd/docs/swagger.json +++ b/cmd/docs/swagger.json @@ -4,6 +4,385 @@ "contact": {} }, "paths": { + "/api/v1/statistics/games/last-played": { + "get": { + "description": "Returns the most recently played games", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get last played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/least-played": { + "get": { + "description": "Returns the top N least played games with their songs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get least played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/most-played": { + "get": { + "description": "Returns the top N most played games with their songs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get most played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/never-played": { + "get": { + "description": "Returns all games that have never been played (times_played = 0)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get never played games", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/games/oldest-played": { + "get": { + "description": "Returns the least recently played games (that have been played at least once)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get oldest played games", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.GameWithSongs" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/songs/least-played": { + "get": { + "description": "Returns the top N least played songs with their game info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get least played songs", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/songs/most-played": { + "get": { + "description": "Returns the top N most played songs with their game info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get most played songs", + "parameters": [ + { + "type": "integer", + "description": "Number of results (default: 10)", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/api/v1/statistics/summary": { + "get": { + "description": "Returns overall statistics about the music library", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "statistics" + ], + "summary": "Get statistics summary", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/backend.StatisticsSummary" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, "/api/v1/token": { "post": { "description": "Returns a new session token for API access", @@ -436,7 +815,7 @@ "tags": [ "music" ], - "summary": "Get all games", + "summary": "Get all soundtracks", "responses": { "200": { "description": "OK", @@ -469,7 +848,7 @@ "tags": [ "music" ], - "summary": "Get all games random", + "summary": "Get all soundtracks random", "responses": { "200": { "description": "OK", @@ -809,10 +1188,10 @@ "tags": [ "sync" ], - "summary": "Sync games with only changes", + "summary": "Sync soundtracks with only changes", "responses": { "200": { - "description": "Start syncing games", + "description": "Start syncing soundtracks", "schema": { "type": "string" } @@ -841,7 +1220,7 @@ "summary": "Sync all games fully", "responses": { "200": { - "description": "Start syncing games full", + "description": "Start syncing soundtracks full", "schema": { "type": "string" } @@ -891,10 +1270,10 @@ "tags": [ "sync" ], - "summary": "Reset games database", + "summary": "Reset soundtracks database", "responses": { "200": { - "description": "Games and songs are deleted from the database", + "description": "Soundtracks and songs are deleted from the database", "schema": { "type": "string" } @@ -971,6 +1350,78 @@ } }, "definitions": { + "backend.GameWithSongs": { + "type": "object", + "properties": { + "game_id": { + "type": "integer" + }, + "game_last_played": { + "type": "string" + }, + "game_name": { + "type": "string" + }, + "game_played": { + "type": "integer" + }, + "songs": { + "type": "array", + "items": { + "$ref": "#/definitions/backend.SongInfoForStats" + } + } + } + }, + "backend.SongInfoForStats": { + "type": "object", + "properties": { + "file_name": { + "type": "string" + }, + "game_id": { + "type": "integer" + }, + "game_name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "song_name": { + "type": "string" + }, + "times_played": { + "type": "integer" + } + } + }, + "backend.StatisticsSummary": { + "type": "object", + "properties": { + "avg_game_plays": { + "type": "number" + }, + "max_game_plays": { + "type": "integer" + }, + "min_game_plays": { + "type": "integer" + }, + "never_played_games": { + "type": "integer" + }, + "played_games": { + "type": "integer" + }, + "total_game_plays": { + "type": "integer" + }, + "total_games": { + "type": "integer" + } + } + }, "backend.VersionData": { "type": "object", "properties": { diff --git a/cmd/docs/swagger.yaml b/cmd/docs/swagger.yaml index 242592d..27a9895 100644 --- a/cmd/docs/swagger.yaml +++ b/cmd/docs/swagger.yaml @@ -1,4 +1,51 @@ definitions: + backend.GameWithSongs: + properties: + game_id: + type: integer + game_last_played: + type: string + game_name: + type: string + game_played: + type: integer + songs: + items: + $ref: '#/definitions/backend.SongInfoForStats' + type: array + type: object + backend.SongInfoForStats: + properties: + file_name: + type: string + game_id: + type: integer + game_name: + type: string + path: + type: string + song_name: + type: string + times_played: + type: integer + type: object + backend.StatisticsSummary: + properties: + avg_game_plays: + type: number + max_game_plays: + type: integer + min_game_plays: + type: integer + never_played_games: + type: integer + played_games: + type: integer + total_game_plays: + type: integer + total_games: + type: integer + type: object backend.VersionData: properties: changelog: @@ -30,6 +77,255 @@ definitions: info: contact: {} paths: + /api/v1/statistics/games/last-played: + get: + consumes: + - application/json + description: Returns the most recently played games + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.GameWithSongs' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get last played games + tags: + - statistics + /api/v1/statistics/games/least-played: + get: + consumes: + - application/json + description: Returns the top N least played games with their songs + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.GameWithSongs' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get least played games + tags: + - statistics + /api/v1/statistics/games/most-played: + get: + consumes: + - application/json + description: Returns the top N most played games with their songs + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.GameWithSongs' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get most played games + tags: + - statistics + /api/v1/statistics/games/never-played: + get: + consumes: + - application/json + description: Returns all games that have never been played (times_played = 0) + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.GameWithSongs' + type: array + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get never played games + tags: + - statistics + /api/v1/statistics/games/oldest-played: + get: + consumes: + - application/json + description: Returns the least recently played games (that have been played + at least once) + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.GameWithSongs' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get oldest played games + tags: + - statistics + /api/v1/statistics/songs/least-played: + get: + consumes: + - application/json + description: Returns the top N least played songs with their game info + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.SongInfoForStats' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get least played songs + tags: + - statistics + /api/v1/statistics/songs/most-played: + get: + consumes: + - application/json + description: Returns the top N most played songs with their game info + parameters: + - description: 'Number of results (default: 10)' + in: query + name: limit + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/backend.SongInfoForStats' + type: array + "400": + description: Bad Request + schema: + additionalProperties: + type: string + type: object + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get most played songs + tags: + - statistics + /api/v1/statistics/summary: + get: + consumes: + - application/json + description: Returns overall statistics about the music library + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/backend.StatisticsSummary' + "500": + description: Internal Server Error + schema: + additionalProperties: + type: string + type: object + summary: Get statistics summary + tags: + - statistics /api/v1/token: delete: consumes: @@ -325,7 +621,7 @@ paths: description: Syncing is in progress schema: type: string - summary: Get all games + summary: Get all soundtracks tags: - music /music/all/random: @@ -347,7 +643,7 @@ paths: description: Syncing is in progress schema: type: string - summary: Get all games random + summary: Get all soundtracks random tags: - music /music/info: @@ -561,14 +857,14 @@ paths: - application/json responses: "200": - description: Start syncing games + description: Start syncing soundtracks schema: type: string "423": description: Syncing is in progress schema: type: string - summary: Sync games with only changes + summary: Sync soundtracks with only changes tags: - sync /sync/full: @@ -580,7 +876,7 @@ paths: - application/json responses: "200": - description: Start syncing games full + description: Start syncing soundtracks full schema: type: string "423": @@ -615,14 +911,14 @@ paths: - application/json responses: "200": - description: Games and songs are deleted from the database + description: Soundtracks and songs are deleted from the database schema: type: string "423": description: Syncing is in progress schema: type: string - summary: Reset games database + summary: Reset soundtracks database tags: - sync /version: diff --git a/cmd/web/assets/css/styles.css b/cmd/web/assets/css/styles.css index 0b889da..12027fe 100644 --- a/cmd/web/assets/css/styles.css +++ b/cmd/web/assets/css/styles.css @@ -1,5 +1,33 @@ /* Pure CSS styles for Music Search */ +:root { + /* Light mode colors (default) */ + --bg-primary: #f3f4f6; + --bg-secondary: #e5e7eb; + --bg-tertiary: #dcfce7; + --text-primary: #000; + --text-secondary: #374151; + --border-primary: #9ca3af; + --border-focus: #6b7280; + --accent-primary: #f97316; + --accent-hover: #ea580c; + --shadow-color: rgba(0, 0, 0, 0.1); +} + +[data-theme="dark"] { + /* Dark mode colors matching frontend */ + --bg-primary: #555; + --bg-secondary: #333; + --bg-tertiary: #2a2a2a; + --text-primary: #fff; + --text-secondary: #ff9c00; + --border-primary: #666; + --border-focus: #ff9c00; + --accent-primary: #ff9c00; + --accent-hover: #e68a00; + --shadow-color: rgba(0, 0, 0, 0.3); +} + * { box-sizing: border-box; margin: 0; @@ -10,7 +38,9 @@ html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; line-height: 1.5; - background-color: #f3f4f6; + background-color: var(--bg-primary); + color: var(--text-primary); + transition: background-color 0.3s ease, color 0.3s ease; } main { @@ -29,15 +59,15 @@ main { max-width: 600px; font-size: 1.5rem; padding: 0.5rem; - border: 1px solid #9ca3af; + border: 1px solid var(--border-primary); border-radius: 0.5rem; - background-color: #e5e7eb; - color: #000; + background-color: var(--bg-secondary); + color: var(--text-primary); } #search_term:focus { outline: none; - border-color: #6b7280; + border-color: var(--border-focus); } #clear { @@ -45,23 +75,48 @@ main { padding: 0.5rem 1rem; border: none; border-radius: 0.5rem; - background-color: #f97316; - color: #fff; + background-color: var(--accent-primary); + color: var(--text-primary); cursor: pointer; margin-left: 1rem; } #clear:hover { - background-color: #ea580c; + background-color: var(--accent-hover); } #games-container { font-size: 1.5rem; } +.game-text { + color: var(--text-primary); + word-break: break-word; +} + +/* Dark mode toggle */ +#dark-mode-toggle { + position: fixed; + top: 1rem; + right: 1rem; + font-size: 1.2rem; + padding: 0.4rem 0.8rem; + border: none; + border-radius: 0.5rem; + background-color: var(--bg-secondary); + color: var(--text-primary); + cursor: pointer; + z-index: 1000; + transition: all 0.3s ease; +} + +#dark-mode-toggle:hover { + background-color: var(--border-primary); +} + /* Game result cards */ .bg-green-100 { - background-color: #dcfce7; + background-color: var(--bg-tertiary); } .p-4 { @@ -69,7 +124,7 @@ main { } .shadow-md { - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); + box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color); } .rounded-lg { diff --git a/cmd/web/hello.templ b/cmd/web/hello.templ index 564fd07..bcbef89 100644 --- a/cmd/web/hello.templ +++ b/cmd/web/hello.templ @@ -2,6 +2,7 @@ package web templ HelloForm() { @Base() { +
{ game }
+{ game }