feat: refactored a shit ton of stuff

This commit is contained in:
Nick 2024-12-09 19:53:09 -06:00
parent 68be562bd3
commit fbdfde8680
232 changed files with 2614 additions and 2532 deletions

View file

@ -0,0 +1,21 @@
module Config.Helpers.Converters exposing (..)
formatName : String -> String
formatName name =
name
|> String.toLower
|> String.replace " " ""
|> String.replace "'" ""
|> String.replace "." ""
|> String.replace "-" ""
|> String.replace "_" ""
formatSocial : String -> String
formatSocial name =
name
|> String.replace "https://x.com/" "@"
|> String.replace "https://www.threads.net/@" "@"
|> String.replace "https://bsky.app/profile/" "@"
|> String.replace "https://www.instagram.com/" "@"

View file

@ -0,0 +1,37 @@
module Config.Helpers.StrengthBar exposing (..)
import Config.Helpers.ToolTip exposing (..)
import Config.Style.Colour exposing (..)
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
barMaker : (Int -> String) -> Int -> Element msg
barMaker getTooltip num =
el
([ E.height <| px 12
, E.width fill
, D.rounded 10
, D.color colourTheme.textDarkGrey
, D.width 2
, B.gradient
{ angle = 1.57
, steps =
List.concat
[ List.repeat num colourTheme.barGreen
, List.repeat (10 - num) colourTheme.barRed
]
}
]
++ [ tooltip (getTooltip num) ]
)
none
barPadding : List (Element msg) -> Element msg
barPadding =
column
[ E.width fill
, E.alignLeft
]

View file

@ -0,0 +1,45 @@
module Config.Helpers.ToolTip exposing (..)
import Config.Style.Colour exposing (..)
import Config.Style.Transitions exposing (transitionStyleSlow)
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html.Attributes as H
tooltip : String -> Attribute msg
tooltip content =
inFront <|
el
[ width fill
, height fill
, transparent True
, mouseOver [ transparent False ]
, htmlAttribute <| H.style "z-index" "4"
, transitionStyleSlow
, below <|
el [ htmlAttribute (H.style "pointerEvents" "none") ] <|
el
[ E.width <| px 300
, htmlAttribute <| H.style "z-index" "4"
, F.size 15
, F.center
, F.regular
, B.color colourTheme.backgroundLightGrey
, F.color colourTheme.textLightGrey
, padding 15
, D.color colourTheme.textLightOrange
, D.rounded 5
, D.width 2
, D.shadow
{ offset = ( 0, 3 )
, blur = 6
, size = 0
, color = rgba 0 0 0 0.32
}
]
(text content)
]
none

View file

@ -0,0 +1,13 @@
module Config.Helpers.Viewport exposing (..)
import Browser.Dom as Dom exposing (setViewport)
import Task exposing (perform)
type Msg
= NoOp
resetViewport : Cmd Msg
resetViewport =
Task.perform (\_ -> NoOp) (Dom.setViewport 0 0)