From 35ca021649601879ff6961c25027fcfffca4f9c4 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Tue, 23 Jan 2024 23:00:51 -0500 Subject: [PATCH] add: more statistics --- api/api.go | 8 +- api/app-routes.go | 121 +++++++++++++++-- api/utils.go | 33 +++++ assets/style.css | 2 +- database/models.go | 50 ++++--- database/query.sql | 33 +++-- database/query.sql.go | 135 ++++++++++++------- database/schema.sql | 143 ++++++++++++++++++--- tailwind.config.js | 6 + templates/components/leaderboard-card.html | 101 +++++++++++++++ templates/pages/document.html | 4 +- templates/pages/documents.html | 2 +- templates/pages/home.html | 68 ++++------ templates/pages/settings.html | 2 +- 14 files changed, 558 insertions(+), 150 deletions(-) create mode 100644 templates/components/leaderboard-card.html diff --git a/api/api.go b/api/api.go index 4894386..e81d73f 100644 --- a/api/api.go +++ b/api/api.go @@ -181,11 +181,13 @@ func (api *API) generateTemplates() *multitemplate.Renderer { templates := make(map[string]*template.Template) render := multitemplate.NewRenderer() helperFuncs := template.FuncMap{ - "GetSVGGraphData": getSVGGraphData, - "GetUTCOffsets": getUTCOffsets, - "NiceSeconds": niceSeconds, "dict": dict, + "fields": fields, + "getSVGGraphData": getSVGGraphData, + "getUTCOffsets": getUTCOffsets, "hasPrefix": strings.HasPrefix, + "niceNumbers": niceNumbers, + "niceSeconds": niceSeconds, } // Load Base diff --git a/api/app-routes.go b/api/app-routes.go index ab83f6e..25069fc 100644 --- a/api/app-routes.go +++ b/api/app-routes.go @@ -14,6 +14,8 @@ import ( "os" "path" "path/filepath" + "reflect" + "sort" "strings" "time" @@ -269,21 +271,46 @@ func (api *API) appGetHome(c *gin.Context) { templateVars, auth := api.getBaseTemplateVars("home", c) start := time.Now() - graphData, _ := api.DB.Queries.GetDailyReadStats(api.DB.Ctx, auth.UserName) - log.Debug("[appGetHome] GetDailyReadStats Performance: ", time.Since(start)) + graphData, err := api.DB.Queries.GetDailyReadStats(api.DB.Ctx, auth.UserName) + if err != nil { + log.Error("[appGetHome] GetDailyReadStats DB Error: ", err) + errorPage(c, http.StatusInternalServerError, fmt.Sprintf("GetDailyReadStats DB Error: %v", err)) + return + } + log.Debug("[appGetHome] GetDailyReadStats DB Performance: ", time.Since(start)) start = time.Now() - databaseInfo, _ := api.DB.Queries.GetDatabaseInfo(api.DB.Ctx, auth.UserName) - log.Debug("[appGetHome] GetDatabaseInfo Performance: ", time.Since(start)) + databaseInfo, err := api.DB.Queries.GetDatabaseInfo(api.DB.Ctx, auth.UserName) + if err != nil { + log.Error("[appGetHome] GetDatabaseInfo DB Error: ", err) + errorPage(c, http.StatusInternalServerError, fmt.Sprintf("GetDatabaseInfo DB Error: %v", err)) + return + } + log.Debug("[appGetHome] GetDatabaseInfo DB Performance: ", time.Since(start)) - streaks, _ := api.DB.Queries.GetUserStreaks(api.DB.Ctx, auth.UserName) - WPMLeaderboard, _ := api.DB.Queries.GetWPMLeaderboard(api.DB.Ctx) + start = time.Now() + streaks, err := api.DB.Queries.GetUserStreaks(api.DB.Ctx, auth.UserName) + if err != nil { + log.Error("[appGetHome] GetUserStreaks DB Error: ", err) + errorPage(c, http.StatusInternalServerError, fmt.Sprintf("GetUserStreaks DB Error: %v", err)) + return + } + log.Debug("[appGetHome] GetUserStreaks DB Performance: ", time.Since(start)) + + start = time.Now() + userStatistics, err := api.DB.Queries.GetUserStatistics(api.DB.Ctx) + if err != nil { + log.Error("[appGetHome] GetUserStatistics DB Error: ", err) + errorPage(c, http.StatusInternalServerError, fmt.Sprintf("GetUserStatistics DB Error: %v", err)) + return + } + log.Debug("[appGetHome] GetUserStatistics DB Performance: ", time.Since(start)) templateVars["Data"] = gin.H{ "Streaks": streaks, "GraphData": graphData, "DatabaseInfo": databaseInfo, - "WPMLeaderboard": WPMLeaderboard, + "UserStatistics": arrangeUserStatistics(userStatistics), } c.HTML(http.StatusOK, "page/home", templateVars) @@ -385,7 +412,8 @@ func (api *API) appPerformAdminAction(c *gin.Context) { // 1. Consume backup ZIP // 2. Move existing to "backup" folder (db, wal, shm, covers, documents) // 3. Extract backup zip - // 4. Restart server? + // 4. Invalidate cookies (see in auth.go logout) + // 5. Restart server? case adminBackup: // Get File Paths fileName := fmt.Sprintf("%s.db", api.Config.DBName) @@ -1244,3 +1272,80 @@ func errorPage(c *gin.Context, errorCode int, errorMessage string) { "Message": errorMessage, }) } + +func arrangeUserStatistics(userStatistics []database.GetUserStatisticsRow) gin.H { + // Item Sorter + sortItem := func(userStatistics []database.GetUserStatisticsRow, key string, less func(i int, j int) bool) []map[string]interface{} { + sortedData := append([]database.GetUserStatisticsRow(nil), userStatistics...) + sort.SliceStable(sortedData, less) + + newData := make([]map[string]interface{}, 0) + for _, item := range sortedData { + v := reflect.Indirect(reflect.ValueOf(item)) + + var value string + if strings.Contains(key, "Wpm") { + rawVal := v.FieldByName(key).Float() + value = fmt.Sprintf("%.2f WPM", rawVal) + } else if strings.Contains(key, "Seconds") { + rawVal := v.FieldByName(key).Int() + value = niceSeconds(rawVal) + } else if strings.Contains(key, "Words") { + rawVal := v.FieldByName(key).Int() + value = niceNumbers(rawVal) + } + + newData = append(newData, map[string]interface{}{ + "UserID": item.UserID, + "Value": value, + }) + } + + return newData + } + + return gin.H{ + "WPM": gin.H{ + "All": sortItem(userStatistics, "TotalWpm", func(i, j int) bool { + return userStatistics[i].TotalWpm > userStatistics[j].TotalWpm + }), + "Year": sortItem(userStatistics, "YearlyWpm", func(i, j int) bool { + return userStatistics[i].YearlyWpm > userStatistics[j].YearlyWpm + }), + "Month": sortItem(userStatistics, "MonthlyWpm", func(i, j int) bool { + return userStatistics[i].MonthlyWpm > userStatistics[j].MonthlyWpm + }), + "Week": sortItem(userStatistics, "WeeklyWpm", func(i, j int) bool { + return userStatistics[i].WeeklyWpm > userStatistics[j].WeeklyWpm + }), + }, + "Duration": gin.H{ + "All": sortItem(userStatistics, "TotalSeconds", func(i, j int) bool { + return userStatistics[i].TotalSeconds > userStatistics[j].TotalSeconds + }), + "Year": sortItem(userStatistics, "YearlySeconds", func(i, j int) bool { + return userStatistics[i].YearlySeconds > userStatistics[j].YearlySeconds + }), + "Month": sortItem(userStatistics, "MonthlySeconds", func(i, j int) bool { + return userStatistics[i].MonthlySeconds > userStatistics[j].MonthlySeconds + }), + "Week": sortItem(userStatistics, "WeeklySeconds", func(i, j int) bool { + return userStatistics[i].WeeklySeconds > userStatistics[j].WeeklySeconds + }), + }, + "Words": gin.H{ + "All": sortItem(userStatistics, "TotalWordsRead", func(i, j int) bool { + return userStatistics[i].TotalWordsRead > userStatistics[j].TotalWordsRead + }), + "Year": sortItem(userStatistics, "YearlyWordsRead", func(i, j int) bool { + return userStatistics[i].YearlyWordsRead > userStatistics[j].YearlyWordsRead + }), + "Month": sortItem(userStatistics, "MonthlyWordsRead", func(i, j int) bool { + return userStatistics[i].MonthlyWordsRead > userStatistics[j].MonthlyWordsRead + }), + "Week": sortItem(userStatistics, "WeeklyWordsRead", func(i, j int) bool { + return userStatistics[i].WeeklyWordsRead > userStatistics[j].WeeklyWordsRead + }), + }, + } +} diff --git a/api/utils.go b/api/utils.go index 6eaf290..e9a6dd7 100644 --- a/api/utils.go +++ b/api/utils.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "math" + "reflect" "reichard.io/antholume/database" "reichard.io/antholume/graph" @@ -87,6 +88,24 @@ func niceSeconds(input int64) (result string) { return } +func niceNumbers(input int64) string { + if input == 0 { + return "0" + } + + abbreviations := []string{"", "k", "M", "B", "T"} + abbrevIndex := int(math.Log10(float64(input)) / 3) + scaledNumber := float64(input) / math.Pow(10, float64(abbrevIndex*3)) + + if scaledNumber >= 100 { + return fmt.Sprintf("%.0f%s", scaledNumber, abbreviations[abbrevIndex]) + } else if scaledNumber >= 10 { + return fmt.Sprintf("%.1f%s", scaledNumber, abbreviations[abbrevIndex]) + } else { + return fmt.Sprintf("%.2f%s", scaledNumber, abbreviations[abbrevIndex]) + } +} + // Convert Database Array -> Int64 Array func getSVGGraphData(inputData []database.GetDailyReadStatsRow, svgWidth int, svgHeight int) graph.SVGGraphData { var intData []int64 @@ -111,3 +130,17 @@ func dict(values ...interface{}) (map[string]interface{}, error) { } return dict, nil } + +func fields(value interface{}) (map[string]interface{}, error) { + v := reflect.Indirect(reflect.ValueOf(value)) + if v.Kind() != reflect.Struct { + return nil, fmt.Errorf("%T is not a struct", value) + } + m := make(map[string]interface{}) + t := v.Type() + for i := 0; i < t.NumField(); i++ { + sv := t.Field(i) + m[sv.Name] = v.Field(i).Interface() + } + return m, nil +} diff --git a/assets/style.css b/assets/style.css index 53a7a77..5e6d4bc 100644 --- a/assets/style.css +++ b/assets/style.css @@ -1 +1 @@ -/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.-bottom-28{bottom:-7rem}.-bottom-5{bottom:-1.25rem}.-top-2{top:-.5rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-7{bottom:1.75rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-5{left:1.25rem}.right-0{right:0}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-16{top:4rem}.top-3{top:.75rem}.top-6{top:1.5rem}.top-7{top:1.75rem}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.float-right{float:right}.float-left{float:left}.m-4{margin:1rem}.m-auto{margin:auto}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-auto{margin-top:auto;margin-bottom:auto}.-ml-6{margin-left:-1.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-6{margin-left:1.5rem}.mr-4{margin-right:1rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-0{height:0}.h-0\.5{height:.125rem}.h-16{height:4rem}.h-2{height:.5rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-7{height:1.75rem}.h-\[100dvh\]{height:100dvh}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[10em\]{max-height:10em}.max-h-\[95\%\]{max-height:95%}.min-h-\[10em\]{min-height:10em}.w-0{width:0}.w-1\/2{width:50%}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5\/6{width:83.333333%}.w-56{width:14rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-\[90\%\]{width:90%}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-screen{width:100vw}.min-w-40{min-width:10rem}.min-w-\[12em\]{min-width:12em}.min-w-\[50\%\]{min-width:50%}.min-w-fit{min-width:-moz-fit-content;min-width:fit-content}.min-w-full{min-width:100%}.max-w-\[50dvw\]{max-width:50dvw}.max-w-screen-sm{max-width:640px}.max-w-screen-xl{max-width:1280px}.flex-1{flex:1 1 0%}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-top-right{transform-origin:top right}.-translate-x-2\/4{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2,.-translate-y-2\/4{--tw-translate-y:-50%}.-translate-y-1\/2,.-translate-y-2\/4,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness:mandatory}.snap-center{scroll-snap-align:center}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.flex-wrap-reverse{flex-wrap:wrap-reverse}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-7{gap:1.75rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem*var(--tw-space-x-reverse));margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-scroll{overflow-y:scroll}.text-ellipsis{text-overflow:ellipsis}.hyphens-auto{-webkit-hyphens:auto;hyphens:auto}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-l{border-top-left-radius:.25rem}.rounded-bl,.rounded-l{border-bottom-left-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.border-purple-500{--tw-border-opacity:1;border-color:rgb(168 85 247/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.bg-\[\#000\]{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-\[\#1f2937\]{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-\[\#232323\]{--tw-bg-opacity:1;background-color:rgb(35 35 35/var(--tw-bg-opacity))}.bg-\[\#d2b48c\]{--tw-bg-opacity:1;background-color:rgb(210 180 140/var(--tw-bg-opacity))}.bg-\[\#fff\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity))}.bg-blue-700{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.object-cover{-o-object-fit:cover;object-fit:cover}.object-fill{-o-object-fit:fill;object-fit:fill}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-12{padding-bottom:3rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-14{padding-left:3.5rem}.pl-6{padding-left:1.5rem}.pr-8{padding-right:2rem}.pt-12{padding-top:3rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-justify{text-align:justify}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-6{line-height:1.5rem}.leading-normal{line-height:1.5}.tracking-tight{letter-spacing:-.025em}.text-\[\#000\]{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-\[\#333\]{--tw-text-opacity:1;color:rgb(51 51 51/var(--tw-text-opacity))}.text-\[\#ccc\]{--tw-text-opacity:1;color:rgb(204 204 204/var(--tw-text-opacity))}.text-\[\#fff\]{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-gray-500{--tw-shadow-color:#6b7280;--tw-shadow:var(--tw-shadow-colored)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-opacity-5{--tw-ring-opacity:0.05}.invert{--tw-invert:invert(100%)}.filter,.invert{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 64 175/var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-400:hover{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.hover\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.hover\:text-black:hover{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.hover\:text-gray-800:hover{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:opacity-100:hover{opacity:1}.focus\:border-transparent:focus{border-color:#0000}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-2:focus,.focus\:ring-4:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-4:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-blue-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253/var(--tw-ring-opacity))}.focus\:ring-purple-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 51 234/var(--tw-ring-opacity))}@media (prefers-color-scheme:dark){.dark\:border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.dark\:border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.dark\:border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity))}.dark\:bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity))}.dark\:bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.dark\:bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.dark\:bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.dark\:bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}.dark\:bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark\:bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark\:bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.dark\:bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.dark\:text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.dark\:text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.dark\:text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.dark\:text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.dark\:text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.dark\:text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.dark\:text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.dark\:text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.dark\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark\:shadow-gray-800{--tw-shadow-color:#1f2937;--tw-shadow:var(--tw-shadow-colored)}.dark\:shadow-gray-900{--tw-shadow-color:#111827;--tw-shadow:var(--tw-shadow-colored)}.dark\:hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark\:hover\:text-gray-100:hover{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.dark\:hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark\:focus\:ring-blue-800:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(30 64 175/var(--tw-ring-opacity))}}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mt-0{margin-top:0}.sm\:grid{display:grid}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:gap-4{gap:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width:768px){.md\:mr-2{margin-right:.5rem}.md\:block{display:block}.md\:table-cell{display:table-cell}.md\:w-1\/2{width:50%}.md\:w-60{width:15rem}.md\:w-fit{width:-moz-fit-content;width:fit-content}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:justify-start{justify-content:flex-start}.md\:px-24{padding-left:6rem;padding-right:6rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:pt-0{padding-top:0}.md\:pt-8{padding-top:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width:1024px){.lg\:mx-48{margin-left:12rem;margin-right:12rem}.lg\:ml-44{margin-left:11rem}.lg\:ml-48{margin-left:12rem}.lg\:hidden{display:none}.lg\:w-48{width:12rem}.lg\:w-80{width:20rem}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:justify-around{justify-content:space-around}.lg\:px-32{padding-left:8rem;padding-right:8rem}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:py-16{padding-top:4rem;padding-bottom:4rem}.lg\:pr-0{padding-right:0}.lg\:text-9xl{font-size:8rem;line-height:1}} \ No newline at end of file +/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.-bottom-28{bottom:-7rem}.-bottom-5{bottom:-1.25rem}.-top-2{top:-.5rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-7{bottom:1.75rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-5{left:1.25rem}.right-0{right:0}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-16{top:4rem}.top-3{top:.75rem}.top-6{top:1.5rem}.top-7{top:1.75rem}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.float-right{float:right}.float-left{float:left}.m-4{margin:1rem}.m-auto{margin:auto}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-auto{margin-top:auto;margin-bottom:auto}.-ml-6{margin-left:-1.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-6{margin-left:1.5rem}.mr-4{margin-right:1rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-0{height:0}.h-0\.5{height:.125rem}.h-16{height:4rem}.h-2{height:.5rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-7{height:1.75rem}.h-\[100dvh\]{height:100dvh}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[10em\]{max-height:10em}.max-h-\[95\%\]{max-height:95%}.min-h-\[10em\]{min-height:10em}.w-0{width:0}.w-1\/2{width:50%}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5\/6{width:83.333333%}.w-56{width:14rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-\[90\%\]{width:90%}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-screen{width:100vw}.min-w-40{min-width:10rem}.min-w-\[12em\]{min-width:12em}.min-w-\[50\%\]{min-width:50%}.min-w-fit{min-width:-moz-fit-content;min-width:fit-content}.min-w-full{min-width:100%}.max-w-\[50dvw\]{max-width:50dvw}.max-w-screen-sm{max-width:640px}.max-w-screen-xl{max-width:1280px}.flex-1{flex:1 1 0%}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-top-right{transform-origin:top right}.-translate-x-2\/4{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2,.-translate-y-2\/4{--tw-translate-y:-50%}.-translate-y-1\/2,.-translate-y-2\/4,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness:mandatory}.snap-center{scroll-snap-align:center}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.flex-wrap-reverse{flex-wrap:wrap-reverse}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-7{gap:1.75rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem*var(--tw-space-x-reverse));margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-scroll{overflow-y:scroll}.text-ellipsis{text-overflow:ellipsis}.hyphens-auto{-webkit-hyphens:auto;hyphens:auto}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-l{border-top-left-radius:.25rem}.rounded-bl,.rounded-l{border-bottom-left-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.border-purple-500{--tw-border-opacity:1;border-color:rgb(168 85 247/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.bg-\[\#000\]{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-\[\#1f2937\]{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-\[\#232323\]{--tw-bg-opacity:1;background-color:rgb(35 35 35/var(--tw-bg-opacity))}.bg-\[\#d2b48c\]{--tw-bg-opacity:1;background-color:rgb(210 180 140/var(--tw-bg-opacity))}.bg-\[\#fff\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity))}.bg-blue-700{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.object-cover{-o-object-fit:cover;object-fit:cover}.object-fill{-o-object-fit:fill;object-fit:fill}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-12{padding-bottom:3rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-0{padding-left:0}.pl-14{padding-left:3.5rem}.pl-6{padding-left:1.5rem}.pr-8{padding-right:2rem}.pt-12{padding-top:3rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-justify{text-align:justify}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-6{line-height:1.5rem}.leading-normal{line-height:1.5}.tracking-tight{letter-spacing:-.025em}.text-\[\#000\]{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-\[\#333\]{--tw-text-opacity:1;color:rgb(51 51 51/var(--tw-text-opacity))}.text-\[\#ccc\]{--tw-text-opacity:1;color:rgb(204 204 204/var(--tw-text-opacity))}.text-\[\#fff\]{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity))}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-gray-500{--tw-shadow-color:#6b7280;--tw-shadow:var(--tw-shadow-colored)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-opacity-5{--tw-ring-opacity:0.05}.invert{--tw-invert:invert(100%)}.filter,.invert{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 64 175/var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-400:hover{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.hover\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.hover\:text-black:hover{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.hover\:text-gray-800:hover{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:opacity-100:hover{opacity:1}.focus\:border-transparent:focus{border-color:#0000}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-2:focus,.focus\:ring-4:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-4:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-blue-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253/var(--tw-ring-opacity))}.focus\:ring-purple-600:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 51 234/var(--tw-ring-opacity))}.peer\/All:checked~.peer-checked\/All\:block,.peer\/Month:checked~.peer-checked\/Month\:block,.peer\/Week:checked~.peer-checked\/Week\:block,.peer\/Year:checked~.peer-checked\/Year\:block{display:block}@media (prefers-color-scheme:dark){.dark\:border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.dark\:border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.dark\:border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity))}.dark\:bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity))}.dark\:bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.dark\:bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.dark\:bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.dark\:bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}.dark\:bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark\:bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark\:bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.dark\:bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.dark\:text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.dark\:text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.dark\:text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity))}.dark\:text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.dark\:text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.dark\:text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.dark\:text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.dark\:text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.dark\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark\:shadow-gray-800{--tw-shadow-color:#1f2937;--tw-shadow:var(--tw-shadow-colored)}.dark\:shadow-gray-900{--tw-shadow-color:#111827;--tw-shadow:var(--tw-shadow-colored)}.dark\:hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark\:hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark\:hover\:text-gray-100:hover{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.dark\:hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark\:focus\:ring-blue-800:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(30 64 175/var(--tw-ring-opacity))}}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mt-0{margin-top:0}.sm\:grid{display:grid}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:gap-4{gap:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width:768px){.md\:mr-2{margin-right:.5rem}.md\:block{display:block}.md\:table-cell{display:table-cell}.md\:w-1\/2{width:50%}.md\:w-60{width:15rem}.md\:w-fit{width:-moz-fit-content;width:fit-content}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:justify-start{justify-content:flex-start}.md\:px-24{padding-left:6rem;padding-right:6rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:pt-0{padding-top:0}.md\:pt-8{padding-top:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width:1024px){.lg\:mx-48{margin-left:12rem;margin-right:12rem}.lg\:ml-44{margin-left:11rem}.lg\:ml-48{margin-left:12rem}.lg\:hidden{display:none}.lg\:w-48{width:12rem}.lg\:w-80{width:20rem}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:justify-around{justify-content:space-around}.lg\:px-32{padding-left:8rem;padding-right:8rem}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:py-16{padding-top:4rem;padding-bottom:4rem}.lg\:pr-0{padding-right:0}.lg\:text-9xl{font-size:8rem;line-height:1}} \ No newline at end of file diff --git a/database/models.go b/database/models.go index 9b2f1d8..63fe65c 100644 --- a/database/models.go +++ b/database/models.go @@ -61,14 +61,23 @@ type DocumentProgress struct { } type DocumentUserStatistic struct { - DocumentID string `json:"document_id"` - UserID string `json:"user_id"` - LastRead string `json:"last_read"` - TotalTimeSeconds int64 `json:"total_time_seconds"` - ReadPercentage float64 `json:"read_percentage"` - Percentage float64 `json:"percentage"` - WordsRead int64 `json:"words_read"` - Wpm float64 `json:"wpm"` + DocumentID string `json:"document_id"` + UserID string `json:"user_id"` + Percentage float64 `json:"percentage"` + LastRead string `json:"last_read"` + ReadPercentage float64 `json:"read_percentage"` + TotalTimeSeconds int64 `json:"total_time_seconds"` + TotalWordsRead int64 `json:"total_words_read"` + TotalWpm float64 `json:"total_wpm"` + YearlyTimeSeconds int64 `json:"yearly_time_seconds"` + YearlyWordsRead int64 `json:"yearly_words_read"` + YearlyWpm float64 `json:"yearly_wpm"` + MonthlyTimeSeconds int64 `json:"monthly_time_seconds"` + MonthlyWordsRead int64 `json:"monthly_words_read"` + MonthlyWpm float64 `json:"monthly_wpm"` + WeeklyTimeSeconds int64 `json:"weekly_time_seconds"` + WeeklyWordsRead int64 `json:"weekly_words_read"` + WeeklyWpm float64 `json:"weekly_wpm"` } type Metadatum struct { @@ -104,14 +113,23 @@ type UserStreak struct { } type ViewDocumentUserStatistic struct { - DocumentID string `json:"document_id"` - UserID string `json:"user_id"` - LastRead interface{} `json:"last_read"` - TotalTimeSeconds sql.NullFloat64 `json:"total_time_seconds"` - ReadPercentage sql.NullFloat64 `json:"read_percentage"` - Percentage float64 `json:"percentage"` - WordsRead interface{} `json:"words_read"` - Wpm int64 `json:"wpm"` + DocumentID string `json:"document_id"` + UserID string `json:"user_id"` + Percentage float64 `json:"percentage"` + LastRead interface{} `json:"last_read"` + ReadPercentage sql.NullFloat64 `json:"read_percentage"` + TotalTimeSeconds sql.NullFloat64 `json:"total_time_seconds"` + TotalWordsRead interface{} `json:"total_words_read"` + TotalWpm int64 `json:"total_wpm"` + YearlyTimeSeconds sql.NullFloat64 `json:"yearly_time_seconds"` + YearlyWordsRead interface{} `json:"yearly_words_read"` + YearlyWpm interface{} `json:"yearly_wpm"` + MonthlyTimeSeconds sql.NullFloat64 `json:"monthly_time_seconds"` + MonthlyWordsRead interface{} `json:"monthly_words_read"` + MonthlyWpm interface{} `json:"monthly_wpm"` + WeeklyTimeSeconds sql.NullFloat64 `json:"weekly_time_seconds"` + WeeklyWordsRead interface{} `json:"weekly_words_read"` + WeeklyWpm interface{} `json:"weekly_wpm"` } type ViewUserStreak struct { diff --git a/database/query.sql b/database/query.sql index 83b589d..681baca 100644 --- a/database/query.sql +++ b/database/query.sql @@ -171,7 +171,7 @@ SELECT docs.filepath, docs.words, - CAST(COALESCE(dus.wpm, 0.0) AS INTEGER) AS wpm, + CAST(COALESCE(dus.total_wpm, 0.0) AS INTEGER) AS wpm, COALESCE(dus.read_percentage, 0) AS read_percentage, COALESCE(dus.total_time_seconds, 0) AS total_time_seconds, STRFTIME('%Y-%m-%d %H:%M:%S', COALESCE(dus.last_read, "1970-01-01"), users.time_offset) @@ -223,7 +223,7 @@ SELECT docs.filepath, docs.words, - CAST(COALESCE(dus.wpm, 0.0) AS INTEGER) AS wpm, + CAST(COALESCE(dus.total_wpm, 0.0) AS INTEGER) AS wpm, COALESCE(dus.read_percentage, 0) AS read_percentage, COALESCE(dus.total_time_seconds, 0) AS total_time_seconds, STRFTIME('%Y-%m-%d %H:%M:%S', COALESCE(dus.last_read, "1970-01-01"), users.time_offset) @@ -308,17 +308,34 @@ WHERE user_id = $user_id; -- name: GetUsers :many SELECT * FROM users; --- name: GetWPMLeaderboard :many +-- name: GetUserStatistics :many SELECT user_id, - CAST(SUM(words_read) AS INTEGER) AS total_words_read, + + CAST(SUM(total_words_read) AS INTEGER) AS total_words_read, CAST(SUM(total_time_seconds) AS INTEGER) AS total_seconds, - ROUND(CAST(SUM(words_read) AS REAL) / (SUM(total_time_seconds) / 60.0), 2) - AS wpm + ROUND(CAST(SUM(total_words_read) AS REAL) / (SUM(total_time_seconds) / 60.0), 2) + AS total_wpm, + + CAST(SUM(yearly_words_read) AS INTEGER) AS yearly_words_read, + CAST(SUM(yearly_time_seconds) AS INTEGER) AS yearly_seconds, + ROUND(CAST(SUM(yearly_words_read) AS REAL) / (SUM(yearly_time_seconds) / 60.0), 2) + AS yearly_wpm, + + CAST(SUM(monthly_words_read) AS INTEGER) AS monthly_words_read, + CAST(SUM(monthly_time_seconds) AS INTEGER) AS monthly_seconds, + ROUND(CAST(SUM(monthly_words_read) AS REAL) / (SUM(monthly_time_seconds) / 60.0), 2) + AS monthly_wpm, + + CAST(SUM(weekly_words_read) AS INTEGER) AS weekly_words_read, + CAST(SUM(weekly_time_seconds) AS INTEGER) AS weekly_seconds, + ROUND(CAST(SUM(weekly_words_read) AS REAL) / (SUM(weekly_time_seconds) / 60.0), 2) + AS weekly_wpm + FROM document_user_statistics -WHERE words_read > 0 +WHERE total_words_read > 0 GROUP BY user_id -ORDER BY wpm DESC; +ORDER BY total_wpm DESC; -- name: GetWantedDocuments :many SELECT diff --git a/database/query.sql.go b/database/query.sql.go index 1e16143..c341da3 100644 --- a/database/query.sql.go +++ b/database/query.sql.go @@ -534,7 +534,7 @@ SELECT docs.filepath, docs.words, - CAST(COALESCE(dus.wpm, 0.0) AS INTEGER) AS wpm, + CAST(COALESCE(dus.total_wpm, 0.0) AS INTEGER) AS wpm, COALESCE(dus.read_percentage, 0) AS read_percentage, COALESCE(dus.total_time_seconds, 0) AS total_time_seconds, STRFTIME('%Y-%m-%d %H:%M:%S', COALESCE(dus.last_read, "1970-01-01"), users.time_offset) @@ -688,7 +688,7 @@ SELECT docs.filepath, docs.words, - CAST(COALESCE(dus.wpm, 0.0) AS INTEGER) AS wpm, + CAST(COALESCE(dus.total_wpm, 0.0) AS INTEGER) AS wpm, COALESCE(dus.read_percentage, 0) AS read_percentage, COALESCE(dus.total_time_seconds, 0) AS total_time_seconds, STRFTIME('%Y-%m-%d %H:%M:%S', COALESCE(dus.last_read, "1970-01-01"), users.time_offset) @@ -971,6 +971,89 @@ func (q *Queries) GetUser(ctx context.Context, userID string) (User, error) { return i, err } +const getUserStatistics = `-- name: GetUserStatistics :many +SELECT + user_id, + + CAST(SUM(total_words_read) AS INTEGER) AS total_words_read, + CAST(SUM(total_time_seconds) AS INTEGER) AS total_seconds, + ROUND(CAST(SUM(total_words_read) AS REAL) / (SUM(total_time_seconds) / 60.0), 2) + AS total_wpm, + + CAST(SUM(yearly_words_read) AS INTEGER) AS yearly_words_read, + CAST(SUM(yearly_time_seconds) AS INTEGER) AS yearly_seconds, + ROUND(CAST(SUM(yearly_words_read) AS REAL) / (SUM(yearly_time_seconds) / 60.0), 2) + AS yearly_wpm, + + CAST(SUM(monthly_words_read) AS INTEGER) AS monthly_words_read, + CAST(SUM(monthly_time_seconds) AS INTEGER) AS monthly_seconds, + ROUND(CAST(SUM(monthly_words_read) AS REAL) / (SUM(monthly_time_seconds) / 60.0), 2) + AS monthly_wpm, + + CAST(SUM(weekly_words_read) AS INTEGER) AS weekly_words_read, + CAST(SUM(weekly_time_seconds) AS INTEGER) AS weekly_seconds, + ROUND(CAST(SUM(weekly_words_read) AS REAL) / (SUM(weekly_time_seconds) / 60.0), 2) + AS weekly_wpm + +FROM document_user_statistics +WHERE total_words_read > 0 +GROUP BY user_id +ORDER BY total_wpm DESC +` + +type GetUserStatisticsRow struct { + UserID string `json:"user_id"` + TotalWordsRead int64 `json:"total_words_read"` + TotalSeconds int64 `json:"total_seconds"` + TotalWpm float64 `json:"total_wpm"` + YearlyWordsRead int64 `json:"yearly_words_read"` + YearlySeconds int64 `json:"yearly_seconds"` + YearlyWpm float64 `json:"yearly_wpm"` + MonthlyWordsRead int64 `json:"monthly_words_read"` + MonthlySeconds int64 `json:"monthly_seconds"` + MonthlyWpm float64 `json:"monthly_wpm"` + WeeklyWordsRead int64 `json:"weekly_words_read"` + WeeklySeconds int64 `json:"weekly_seconds"` + WeeklyWpm float64 `json:"weekly_wpm"` +} + +func (q *Queries) GetUserStatistics(ctx context.Context) ([]GetUserStatisticsRow, error) { + rows, err := q.db.QueryContext(ctx, getUserStatistics) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetUserStatisticsRow + for rows.Next() { + var i GetUserStatisticsRow + if err := rows.Scan( + &i.UserID, + &i.TotalWordsRead, + &i.TotalSeconds, + &i.TotalWpm, + &i.YearlyWordsRead, + &i.YearlySeconds, + &i.YearlyWpm, + &i.MonthlyWordsRead, + &i.MonthlySeconds, + &i.MonthlyWpm, + &i.WeeklyWordsRead, + &i.WeeklySeconds, + &i.WeeklyWpm, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getUserStreaks = `-- name: GetUserStreaks :many SELECT user_id, "window", max_streak, max_streak_start_date, max_streak_end_date, current_streak, current_streak_start_date, current_streak_end_date FROM user_streaks WHERE user_id = ?1 @@ -1041,54 +1124,6 @@ func (q *Queries) GetUsers(ctx context.Context) ([]User, error) { return items, nil } -const getWPMLeaderboard = `-- name: GetWPMLeaderboard :many -SELECT - user_id, - CAST(SUM(words_read) AS INTEGER) AS total_words_read, - CAST(SUM(total_time_seconds) AS INTEGER) AS total_seconds, - ROUND(CAST(SUM(words_read) AS REAL) / (SUM(total_time_seconds) / 60.0), 2) - AS wpm -FROM document_user_statistics -WHERE words_read > 0 -GROUP BY user_id -ORDER BY wpm DESC -` - -type GetWPMLeaderboardRow struct { - UserID string `json:"user_id"` - TotalWordsRead int64 `json:"total_words_read"` - TotalSeconds int64 `json:"total_seconds"` - Wpm float64 `json:"wpm"` -} - -func (q *Queries) GetWPMLeaderboard(ctx context.Context) ([]GetWPMLeaderboardRow, error) { - rows, err := q.db.QueryContext(ctx, getWPMLeaderboard) - if err != nil { - return nil, err - } - defer rows.Close() - var items []GetWPMLeaderboardRow - for rows.Next() { - var i GetWPMLeaderboardRow - if err := rows.Scan( - &i.UserID, - &i.TotalWordsRead, - &i.TotalSeconds, - &i.Wpm, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - const getWantedDocuments = `-- name: GetWantedDocuments :many SELECT CAST(value AS TEXT) AS id, diff --git a/database/schema.sql b/database/schema.sql index c9a359e..5dbecfa 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -128,15 +128,29 @@ CREATE TEMPORARY TABLE IF NOT EXISTS user_streaks ( current_streak_end_date TEXT NOT NULL ); +-- Temporary Document User Statistics Table (Cached from View) CREATE TEMPORARY TABLE IF NOT EXISTS document_user_statistics ( document_id TEXT NOT NULL, user_id TEXT NOT NULL, - last_read TEXT NOT NULL, - total_time_seconds INTEGER NOT NULL, - read_percentage REAL NOT NULL, percentage REAL NOT NULL, - words_read INTEGER NOT NULL, - wpm REAL NOT NULL, + last_read TEXT NOT NULL, + read_percentage REAL NOT NULL, + + total_time_seconds INTEGER NOT NULL, + total_words_read INTEGER NOT NULL, + total_wpm REAL NOT NULL, + + yearly_time_seconds INTEGER NOT NULL, + yearly_words_read INTEGER NOT NULL, + yearly_wpm REAL NOT NULL, + + monthly_time_seconds INTEGER NOT NULL, + monthly_words_read INTEGER NOT NULL, + monthly_wpm REAL NOT NULL, + + weekly_time_seconds INTEGER NOT NULL, + weekly_words_read INTEGER NOT NULL, + weekly_wpm REAL NOT NULL, UNIQUE(document_id, user_id) ON CONFLICT REPLACE ); @@ -177,7 +191,6 @@ WITH document_windows AS ( LEFT JOIN users ON users.id = activity.user_id GROUP BY activity.user_id, weekly_read, daily_read ), - weekly_partitions AS ( SELECT user_id, @@ -190,7 +203,6 @@ weekly_partitions AS ( FROM document_windows GROUP BY user_id, weekly_read ), - daily_partitions AS ( SELECT user_id, @@ -203,7 +215,6 @@ daily_partitions AS ( FROM document_windows GROUP BY user_id, daily_read ), - streaks AS ( SELECT COUNT(*) AS streak, @@ -327,8 +338,8 @@ current_progress AS ( WHERE dp.user_id = iga.user_id AND dp.document_id = iga.document_id - ORDER BY created_at DESC - LIMIT 1 + ORDER BY created_at DESC + LIMIT 1 ), end_percentage) AS percentage FROM intermediate_ga AS iga GROUP BY user_id, document_id @@ -338,25 +349,121 @@ current_progress AS ( SELECT ga.document_id, ga.user_id, - MAX(start_time) AS last_read, - SUM(duration) AS total_time_seconds, - SUM(read_percentage) AS read_percentage, cp.percentage, + MAX(start_time) AS last_read, + SUM(read_percentage) AS read_percentage, + -- All Time WPM + SUM(duration) AS total_time_seconds, (CAST(COALESCE(d.words, 0.0) AS REAL) * SUM(read_percentage)) - AS words_read, + AS total_words_read, + (CAST(COALESCE(d.words, 0.0) AS REAL) * SUM(read_percentage)) + / (SUM(duration) / 60.0) AS total_wpm, + + -- Yearly WPM + SUM(CASE WHEN start_time >= DATE('now', '-1 year') THEN duration ELSE 0 END) + AS yearly_time_seconds, + ( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-1 year') THEN read_percentage + ELSE 0 + END + ) + ) + AS yearly_words_read, + COALESCE(( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-1 year') THEN read_percentage + END + ) + ) + / ( + SUM( + CASE + WHEN start_time >= DATE('now', '-1 year') THEN duration + END + ) + / 60.0 + ), 0.0) + AS yearly_wpm, + + -- Monthly WPM + SUM( + CASE WHEN start_time >= DATE('now', '-1 month') THEN duration ELSE 0 END + ) + AS monthly_time_seconds, + ( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-1 month') THEN read_percentage + ELSE 0 + END + ) + ) + AS monthly_words_read, + COALESCE(( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-1 month') THEN read_percentage + END + ) + ) + / ( + SUM( + CASE + WHEN start_time >= DATE('now', '-1 month') THEN duration + END + ) + / 60.0 + ), 0.0) + AS monthly_wpm, + + -- Weekly WPM + SUM(CASE WHEN start_time >= DATE('now', '-7 days') THEN duration ELSE 0 END) + AS weekly_time_seconds, + ( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-7 days') THEN read_percentage + ELSE 0 + END + ) + ) + AS weekly_words_read, + COALESCE(( + CAST(COALESCE(d.words, 0.0) AS REAL) + * SUM( + CASE + WHEN start_time >= DATE('now', '-7 days') THEN read_percentage + END + ) + ) + / ( + SUM( + CASE + WHEN start_time >= DATE('now', '-7 days') THEN duration + END + ) + / 60.0 + ), 0.0) + AS weekly_wpm - (CAST(COALESCE(d.words, 0.0) AS REAL) * SUM(read_percentage)) - / (SUM(duration) / 60.0) AS wpm FROM grouped_activity AS ga INNER JOIN current_progress AS cp ON ga.user_id = cp.user_id AND ga.document_id = cp.document_id INNER JOIN documents AS d - ON d.id = ga.document_id + ON ga.document_id = d.id GROUP BY ga.document_id, ga.user_id -ORDER BY wpm DESC; +ORDER BY total_wpm DESC; --------------------------------------------------------------- ------------------ Populate Temporary Tables ------------------ diff --git a/tailwind.config.js b/tailwind.config.js index adc635f..2a6461e 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,6 +5,12 @@ module.exports = { "./assets/local/*.{html,htm,svg,js}", "./assets/reader/*.{html,htm,svg,js}", ], + safelist: [ + "peer-checked/All:block", + "peer-checked/Year:block", + "peer-checked/Month:block", + "peer-checked/Week:block", + ], theme: { extend: { minWidth: { diff --git a/templates/components/leaderboard-card.html b/templates/components/leaderboard-card.html new file mode 100644 index 0000000..793950c --- /dev/null +++ b/templates/components/leaderboard-card.html @@ -0,0 +1,101 @@ +
+
+
+
+

+ {{ .Name }} Leaderboard +

+
+ + + + +
+
+
+ + + + + + + {{ range $key, $data := .Data }} + + +
diff --git a/templates/pages/document.html b/templates/pages/document.html index 6a0da46..151b56d 100644 --- a/templates/pages/document.html +++ b/templates/pages/document.html @@ -214,13 +214,13 @@

Est. Time Left

- {{ NiceSeconds .TotalTimeLeftSeconds }} + {{ niceSeconds .TotalTimeLeftSeconds }}

- {{ NiceSeconds .Data.TotalTimeSeconds }} + {{ niceSeconds .Data.TotalTimeSeconds }}

diff --git a/templates/pages/documents.html b/templates/pages/documents.html index 303134c..9f81336 100644 --- a/templates/pages/documents.html +++ b/templates/pages/documents.html @@ -75,7 +75,7 @@

Time Read

- {{ NiceSeconds $doc.TotalTimeSeconds }} + {{ niceSeconds $doc.TotalTimeSeconds }}

diff --git a/templates/pages/home.html b/templates/pages/home.html index 4807226..4971e98 100644 --- a/templates/pages/home.html +++ b/templates/pages/home.html @@ -12,7 +12,7 @@ Daily Read Totals

- {{ $data := (GetSVGGraphData .Data.GraphData 800 70 )}} + {{ $data := (getSVGGraphData .Data.GraphData 800 70 )}} +
+ {{ template "component/leaderboard-card" ( + dict + "Name" "WPM" + "Data" .Data.UserStatistics.WPM + ) + }} + + {{ template "component/leaderboard-card" ( + dict + "Name" "Duration" + "Data" .Data.UserStatistics.Duration + ) + }} + + {{ template "component/leaderboard-card" ( + dict + "Name" "Words" + "Data" .Data.UserStatistics.Words + ) + }} + + +
+
{{ range $item := .Data.Streaks }}
@@ -211,46 +236,5 @@
{{ end }} -
-
-
-

- WPM Leaderboard -

-
- {{ $length := len .Data.WPMLeaderboard }} {{ if eq $length 0 }} -

N/A

- {{ else }} -

- {{ (index .Data.WPMLeaderboard 0).UserID }} -

- {{ end }} -
-
-
- {{ range $index, $item := .Data.WPMLeaderboard }} {{ if lt $index 3 }} - {{ if eq $index 0 }} -
- {{ else }} -
- {{ end }} -
-

{{ $item.UserID }}

-
-
{{ $item.Wpm }} WPM
-
- {{ end }} {{ end }} -
-
-
-
- {{end}} -
diff --git a/templates/pages/settings.html b/templates/pages/settings.html index 774cc9a..97a0591 100644 --- a/templates/pages/settings.html +++ b/templates/pages/settings.html @@ -87,7 +87,7 @@ id="time_offset" name="time_offset" > - {{ range $item := GetUTCOffsets }} + {{ range $item := getUTCOffsets }}