feat: init

This commit is contained in:
Nick 2024-11-10 22:55:49 -06:00
parent be12403f13
commit 7145b8a9fa
21 changed files with 591 additions and 9 deletions

View file

@ -0,0 +1,4 @@
module Config.Identity exposing (..)
myName : String
myName = "The Nutrivore"

View file

@ -0,0 +1,24 @@
module Config.Theme exposing (..)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
type alias Theme =
{ nonHighlightedText : Color
, nonHighlightedDarkText : Color
, highlightText : Color
, backgroundColour : Color
, debugColour : Color
}
colourTheme : Theme
colourTheme =
{ nonHighlightedText = rgb255 212 212 212
, nonHighlightedDarkText = rgb255 126 126 126
, highlightText = rgb255 204 102 0
, backgroundColour = rgb255 40 40 40
, debugColour = rgb255 227 28 121
}

View file

@ -0,0 +1,82 @@
module Pages.Contact exposing (Model, Msg, page)
import Config.Identity as ID exposing (..)
import Config.Theme as T exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
import Element.Events as E
import Page exposing (Page)
import Route exposing (Route)
import Shared
import View exposing (View)
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}
-- INIT
type alias Model =
{ num : Int }
init : () -> ( Model, Effect Msg )
init () =
( { num = 0 }
, Effect.none
)
-- UPDATE
type Msg
= Inc
| Dec
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
Inc ->
( { model | num = model.num + 1 }
, Effect.none
)
Dec ->
( { model | num = model.num - 1 }
, Effect.none
)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
view : Model -> View Msg
view model =
{ title = ""
, attributes = []
, element = el [E.onClick Inc] (text <| "a string is fun" ++ String.fromInt model.num)
}

170
frontend/src/Pages/Home_.elm Executable file
View file

@ -0,0 +1,170 @@
module Pages.Home_ exposing (page)
import Config.Identity as ID exposing (..)
import Config.Theme as T exposing (..)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
import Element.Region exposing (description)
import View exposing (View)
-- Use this if you fuck something up
-- Element.explain Debug.todo
page : View msg
page =
{ title = myName
, attributes = [ F.family [ spartanFont ] ]
, element = topLevelContainer
}
spartanFont : F.Font
spartanFont =
F.typeface "League Spartan"
topLevelContainer : Element msg
topLevelContainer =
el
[ width fill
, height fill
, B.color colourTheme.backgroundColour
]
linkList
linkList : Element msg
linkList =
column
[ spacing 20
, centerX
, centerY
, F.color (rgb255 67 67 67)
]
links
imageSpacer : Attribute msg
imageSpacer =
spacing 20
titleFormat : List (Attr () msg)
titleFormat =
[ F.size 23
, F.bold
, F.color colourTheme.highlightText
]
paragraphFontSize : Attr decorative msg
paragraphFontSize =
F.size 17
paragraphLinkFormat : { url : String, label : Element msg } -> Element msg
paragraphLinkFormat =
newTabLink
[ paragraphFontSize
, F.color colourTheme.highlightText
]
paragraphFormat : List (Attr () msg)
paragraphFormat =
[ spacing 8
, paragraphFontSize
, F.color colourTheme.nonHighlightedText
]
paragraphColumnFormat : List (Attribute msg)
paragraphColumnFormat =
[ spacing 20
, width <| px 700
]
imageFormat : List (Attribute msg)
imageFormat =
[ width <| px 150
, alignTop
]
recommendedClients : Element msg
recommendedClients =
el [ F.bold ] (text "Recommended Clients: ")
links : List (Element msg)
links =
[ column
[ spacing 40 ]
[ row [ imageSpacer ]
[ image imageFormat
{ src = "mastodon.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://the-nutrivore.social/"
, label = text "MASTODON"
}
, paragraph paragraphFormat [ text "Microblogging will now be posted to my own self-hosted Mastodon instance. I've kinda grown tired of microblogging on X, where political correctness and unclear ban policies force me to constantly self-censor. I considered and ultimately rejected several alternative platforms. Eventually, I realized the solution to this problem is to simply self-host my own spacesomewhere where I can be myself and speak as I please. And I recently obtained the necessary infrastructure to do this." ]
, paragraph paragraphFormat [ text "This instance is 100% mine, and I can't be censored or fucked with there. I invite everyone who values my content and interactions to follow me on this new platform (whether you agree with my views or not). My instance is a \"single-user\" instances, meaning I'm the only user. But you can still follow me! Just make an account on another instance, like ", paragraphLinkFormat { url = "https://mastodon.social", label = text "Mastodon.social" }, text " (alternatively, you can select whatever instance you wish from the ",paragraphLinkFormat { url = "https://instances.social/", label = text "official index"} , text "), follow me, and turn on notifications." ]
, paragraph paragraphFormat
[ recommendedClients
, paragraphLinkFormat { url = "https://github.com/LucasGGamerM/moshidon", label = text "Moshidon" }
, text " (android) "
, paragraphLinkFormat { url = "https://github.com/mastodon/mastodon-android", label = text "Official" }
, text " (android) "
, paragraphLinkFormat { url = "https://github.com/tuskyapp/Tusky", label = text "Tusky" }
, text " (android) "
, paragraphLinkFormat { url = "https://apps.apple.com/us/app/mastodon/id1571998974", label = text "Official" }
, text " (iOS)"
]
]
]
, row [ imageSpacer ]
[ image imageFormat
{ src = "peertube.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://video.the-nutrivore.social/"
, label = text "PEERTUBE"
}
, paragraph paragraphFormat [ text "I'm transitioning my video content from YouTube to my self-hosted PeerTube instance, because I strongly believe in freedom of speech, copyleft, and digital autonomy. YouTube has proven unreliable due to both censorship and copyright strikes levied against my channel. This shift allows me to better control my content and avoid these silly pitfalls." ]
, paragraph paragraphFormat [ text "Full-length videos are now exclusively available on PeerTube, while YouTube will only host clips. By registering on PeerTube and subscribing to my channels, you'll have access to all content. Just be sure to enable email notifications to be alerted of new uploads. I believe that those who are truly fans of my work and want the best experience possible will see this as a positive change." ]
, paragraph paragraphFormat [ recommendedClients, text "Unfortunately, I can't recommend any mobile clients for PeerTube at this time. They're all trash. Please use your browser, either on your mobile device or personal computer. Just be use to enable email notifications in your account settings." ]
]
]
, row [ imageSpacer ]
[ image imageFormat
{ src = "discord.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://discord.gg/eeYQ2wJknS"
, label = text "DISCORD"
}
, paragraph paragraphFormat [ text "The Nutrivore Discord server is an evidence-based community dedicated to debunking pseudoscience, especially in the fields of nutrition, health and fitness. Casual discourse is welcome, and includes topics such as cooking, gaming, technology, and more. Current members span many disciplines and include both students and professionals, all levels of interest and expertise are welcome." ]
, paragraph paragraphFormat [ text "The Discord server is not explicitly a debate server. However, we strongly encourage that disagreements be resolved using debate (preferably verbal), as long as it is conducted respectfully and in good faith. Though we also firmly believe that shaming sophistry and bad faith behaviour is a net good overall. The Discord server is planned to be replaced with a Matrix server in future." ]
, paragraph paragraphFormat
[ recommendedClients
, paragraphLinkFormat { url = "https://github.com/Vendicated/Vencord", label = text "Vencord" }
, text " (desktop) "
, paragraphLinkFormat { url = "https://discord.com/download", label = text "Official" }
, text " (multi-platform) "
]
]
]
]
]

89
frontend/src/View.elm Executable file
View file

@ -0,0 +1,89 @@
module View exposing
( View, map
, none, fromString
, toBrowserDocument
)
{-|
@docs View, map
@docs none, fromString
@docs toBrowserDocument
-}
import Browser
import Element exposing (Attribute, Element, layout, mapAttribute, text)
import Route exposing (Route)
import Shared.Model
type alias View msg =
{ title : String
, attributes : List (Attribute msg)
, element : Element msg
}
{-| Used internally by Elm Land to create your application
so it works with Elm's expected `Browser.Document msg` type.
-}
toBrowserDocument :
{ shared : Shared.Model.Model
, route : Route ()
, view : View msg
}
-> Browser.Document msg
toBrowserDocument { view } =
{ title = view.title
, body = [ layout view.attributes view.element ]
}
-- toBrowserDocument :
-- { shared : Shared.Model.Model
-- , route : Route ()
-- , view : View msg
-- }
-- -> Browser.Document msg
-- toBrowserDocument { view } =
-- { title = view.title
-- , body = view.body
-- }
{-| Used internally by Elm Land to connect your pages together.
-}
map : (msg1 -> msg2) -> View msg1 -> View msg2
map fn view =
{ title = view.title
, attributes = List.map (mapAttribute fn) view.attributes
, element = Element.map fn view.element
}
{-| Used internally by Elm Land whenever transitioning between
authenticated pages.
-}
none : View msg
none =
{ title = ""
, attributes = []
, element = Element.none
}
{-| If you customize the `View` module, anytime you run `elm-land add page`,
the generated page will use this when adding your `view` function.
That way your app will compile after adding new pages, and you can see
the new page working in the web browser!
-}
fromString : String -> View msg
fromString moduleName =
{ title = moduleName
, attributes = []
, element = text moduleName
}