parent
d6fdc6f159
commit
0cf2b871c8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@ |
||||
<!DOCTYPE html><html><head></head><body><div id="a"></div><script src="./prof.js"></script><script>Elm.Prof.init({node:document.getElementById("a")})</script></body></html> |
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,53 @@ |
||||
module Couleur exposing (Couleur) |
||||
|
||||
|
||||
type alias Couleur = |
||||
{ rouge : Float |
||||
, vert : Float |
||||
, bleu : Float |
||||
} |
||||
|
||||
|
||||
plusSombre : Float -> Couleur -> Couleur |
||||
plusSombre taux { red, green, blue, alpha } = |
||||
if red < green && red < blue then |
||||
let |
||||
nouveauRouge = |
||||
red * taux |
||||
|
||||
nouveauPasRouge = |
||||
nouveauRouge - red |
||||
in |
||||
{ red = nouveauRouge |
||||
, green = green + nouveauPasRouge |
||||
, blue = blue + nouveauPasRouge |
||||
, alpha = alpha |
||||
} |
||||
|
||||
else if green < blue then |
||||
let |
||||
nouveauVert = |
||||
green * taux |
||||
|
||||
nouveauPasVert = |
||||
nouveauVert - green |
||||
in |
||||
{ red = red + nouveauPasVert |
||||
, green = nouveauVert |
||||
, blue = blue + nouveauPasVert |
||||
, alpha = alpha |
||||
} |
||||
|
||||
else |
||||
let |
||||
nouveauBleu = |
||||
blue * taux |
||||
|
||||
nouveauPasBleu = |
||||
nouveauBleu - blue |
||||
in |
||||
{ red = red + nouveauPasBleu |
||||
, green = green + nouveauPasBleu |
||||
, blue = blue + nouveauBleu |
||||
, alpha = alpha |
||||
} |
||||
@ -0,0 +1,18 @@ |
||||
module Echologo exposing (echologo) |
||||
|
||||
import Element exposing (..) |
||||
import Svg exposing (..) |
||||
import Svg.Attributes as SvgA exposing (cx, cy, d, r, strokeWidth, viewBox) |
||||
|
||||
|
||||
echologo taille = |
||||
html <| |
||||
svg [ viewBox "0 0 30 30", SvgA.height <| String.fromInt taille ] |
||||
[ circle [ cx "15", cy "15", r "15", SvgA.fill "#64c29b", strokeWidth "0" ] [] |
||||
, g [ SvgA.fill "#fff", strokeWidth "0" ] |
||||
[ circle [ cx "13.8", cy "9", r "2" ] [] |
||||
, path [ d "M 12.3,6.4019238 A 3,3 0 0 0 11.201924,10.5 5,5 0 0 1 12.3,2.1592831 a 3,3 0 0 0 0,4.2426407" ] [] |
||||
, path [ d "m13.8 6a3 3 0 0 1 3 3 6 6 0 0 1 8.485281 0 8 8 0 0 0-11.485281-3" ] [] |
||||
, path [ d "M 12.3,11.598076 A 3,3 0 0 0 16.398076,10.5 13,13 0 0 1 12.3,28.568639 a 12,12 0 0 0 0,-16.970563" ] [] |
||||
] |
||||
] |
||||
@ -1,64 +0,0 @@ |
||||
module Main exposing (..) |
||||
|
||||
-- Press buttons to increment and decrement a counter. |
||||
-- |
||||
-- Read how it works: |
||||
-- https://guide.elm-lang.org/architecture/buttons.html |
||||
-- |
||||
|
||||
|
||||
import Browser |
||||
import Html exposing (Html, button, div, text) |
||||
import Html.Events exposing (onClick) |
||||
|
||||
|
||||
|
||||
-- MAIN |
||||
|
||||
|
||||
main = |
||||
Browser.sandbox { init = init, update = update, view = view } |
||||
|
||||
|
||||
|
||||
-- MODEL |
||||
|
||||
|
||||
type alias Model = Int |
||||
|
||||
|
||||
init : Model |
||||
init = |
||||
0 |
||||
|
||||
|
||||
|
||||
-- UPDATE |
||||
|
||||
|
||||
type Msg |
||||
= Increment |
||||
| Decrement |
||||
|
||||
|
||||
update : Msg -> Model -> Model |
||||
update msg model = |
||||
case msg of |
||||
Increment -> |
||||
model + 1 |
||||
|
||||
Decrement -> |
||||
model - 1 |
||||
|
||||
|
||||
|
||||
-- VIEW |
||||
|
||||
|
||||
view : Model -> Html Msg |
||||
view model = |
||||
div [] |
||||
[ button [ onClick Decrement ] [ text "-" ] |
||||
, div [] [ text (String.fromInt model) ] |
||||
, button [ onClick Increment ] [ text "+" ] |
||||
] |
||||
@ -0,0 +1,234 @@ |
||||
module Prof exposing (main) |
||||
|
||||
import Browser |
||||
import Browser.Navigation as Nav |
||||
import CalculateurDeNotes |
||||
import Echologo exposing (..) |
||||
import Element exposing (..) |
||||
import Element.Background as Background |
||||
import Element.Border as Border |
||||
import Element.Events exposing (..) |
||||
import Element.Font as Font |
||||
import GenerateurDeProblemes |
||||
import Html exposing (Html) |
||||
import Html.Attributes |
||||
import Style exposing (..) |
||||
import Url |
||||
|
||||
|
||||
|
||||
{- |
||||
███ ███ █████ ██ ███ ██ |
||||
████ ████ ██ ██ ██ ████ ██ |
||||
██ ████ ██ ███████ ██ ██ ██ ██ |
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ |
||||
██ ██ ██ ██ ██ ██ ████ |
||||
-} |
||||
|
||||
|
||||
main : Program () Model Msg |
||||
main = |
||||
Browser.application |
||||
{ init = init |
||||
, view = view |
||||
, update = update |
||||
, subscriptions = subscriptions |
||||
, onUrlChange = UrlChanged |
||||
, onUrlRequest = LinkClicked |
||||
} |
||||
|
||||
|
||||
|
||||
-- MODEL |
||||
|
||||
|
||||
type alias Model = |
||||
{ key : Nav.Key |
||||
, url : Url.Url |
||||
, page : Page |
||||
, modeleGenerateurDeProblemes : GenerateurDeProblemes.Model |
||||
, modeleCalculateurDeNotes : CalculateurDeNotes.Model |
||||
} |
||||
|
||||
|
||||
type Page |
||||
= GenerateurDeProblemes |
||||
| CalculateurDeNotes |
||||
|
||||
|
||||
init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg ) |
||||
init flags url key = |
||||
case url.fragment of |
||||
Just "CalculateurDeNotes" -> |
||||
( Model key |
||||
url |
||||
CalculateurDeNotes |
||||
GenerateurDeProblemes.init |
||||
CalculateurDeNotes.init |
||||
, Cmd.none |
||||
) |
||||
|
||||
Just "GenerateurDeProblemes" -> |
||||
( Model key |
||||
url |
||||
GenerateurDeProblemes |
||||
GenerateurDeProblemes.init |
||||
CalculateurDeNotes.init |
||||
, Cmd.none |
||||
) |
||||
|
||||
_ -> |
||||
( Model key |
||||
{ url | fragment = Just "GenerateurDeProblemes" } |
||||
GenerateurDeProblemes |
||||
GenerateurDeProblemes.init |
||||
CalculateurDeNotes.init |
||||
, Nav.pushUrl key (Url.toString { url | fragment = Just "GenerateurDeProblemes" }) |
||||
) |
||||
|
||||
|
||||
|
||||
-- UPDATE |
||||
|
||||
|
||||
type Msg |
||||
= LinkClicked Browser.UrlRequest |
||||
| UrlChanged Url.Url |
||||
| CalculateurDeNotesMsg CalculateurDeNotes.Msg |
||||
| GenerateurDeProblemesMsg GenerateurDeProblemes.Msg |
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg ) |
||||
update msg model = |
||||
case ( msg, model.page ) of |
||||
( LinkClicked urlRequest, _ ) -> |
||||
case urlRequest of |
||||
Browser.Internal url -> |
||||
( model, Nav.pushUrl model.key (Url.toString url) ) |
||||
|
||||
Browser.External href -> |
||||
( model, Nav.load href ) |
||||
|
||||
( UrlChanged url, _ ) -> |
||||
case url.fragment of |
||||
Just "CalculateurDeNotes" -> |
||||
( { model |
||||
| url = url |
||||
, page = CalculateurDeNotes |
||||
} |
||||
, Cmd.none |
||||
) |
||||
|
||||
Just "GenerateurDeProblemes" -> |
||||
( { model |
||||
| url = url |
||||
, page = GenerateurDeProblemes |
||||
} |
||||
, Cmd.none |
||||
) |
||||
|
||||
_ -> |
||||
( { model |
||||
| url = { url | fragment = Just "GenerateurDeProblemes" } |
||||
, page = GenerateurDeProblemes |
||||
} |
||||
, Nav.pushUrl model.key (Url.toString { url | fragment = Just "GenerateurDeProblemes" }) |
||||
) |
||||
|
||||
( GenerateurDeProblemesMsg message, GenerateurDeProblemes ) -> |
||||
let |
||||
( nouveauModele, commande ) = |
||||
GenerateurDeProblemes.update message |
||||
model.modeleGenerateurDeProblemes |
||||
in |
||||
( { model |
||||
| modeleGenerateurDeProblemes = nouveauModele |
||||
} |
||||
, Cmd.map GenerateurDeProblemesMsg commande |
||||
) |
||||
|
||||
( CalculateurDeNotesMsg message, CalculateurDeNotes ) -> |
||||
let |
||||
( nouveauModele, commande ) = |
||||
CalculateurDeNotes.update message model.modeleCalculateurDeNotes |
||||
in |
||||
( { model |
||||
| modeleCalculateurDeNotes = nouveauModele |
||||
} |
||||
, Cmd.map CalculateurDeNotesMsg commande |
||||
) |
||||
|
||||
_ -> |
||||
( model, Cmd.none ) |
||||
|
||||
|
||||
|
||||
-- SUBSCRIPTIONS |
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg |
||||
subscriptions _ = |
||||
Sub.none |
||||
|
||||
|
||||
|
||||
-- VIEW |
||||
|
||||
|
||||
view : Model -> Browser.Document Msg |
||||
view model = |
||||
case model.page of |
||||
CalculateurDeNotes -> |
||||
{ title = CalculateurDeNotes.titre |
||||
, body = |
||||
[ CalculateurDeNotes.view model.modeleCalculateurDeNotes |
||||
|> Element.map CalculateurDeNotesMsg |
||||
|> designGeneral CalculateurDeNotes.titre |
||||
] |
||||
} |
||||
|
||||
GenerateurDeProblemes -> |
||||
{ title = GenerateurDeProblemes.titre |
||||
, body = |
||||
[ GenerateurDeProblemes.view model.modeleGenerateurDeProblemes |
||||
|> Element.map GenerateurDeProblemesMsg |
||||
|> designGeneral GenerateurDeProblemes.titre |
||||
] |
||||
} |
||||
|
||||
|
||||
designGeneral titre elm = |
||||
layout |
||||
[ height fill |
||||
, width fill |
||||
, padding tresGrandEspacement |
||||
, Background.color <| vert 0.2 |
||||
] |
||||
<| |
||||
column |
||||
[ height fill |
||||
, width fill |
||||
, Background.color <| vert 0 |
||||
, Border.rounded 13 |
||||
] |
||||
[ row [] |
||||
[ echologo 135 |
||||
, el |
||||
[ Font.size 120 |
||||
, Font.color <| vert 0.2 |
||||
, Font.shadow |
||||
{ offset = ( 2, 2 ) |
||||
, blur = 3 |
||||
, color = vert 1 |
||||
} |
||||
] |
||||
<| |
||||
text titre |
||||
] |
||||
, elm |
||||
] |
||||
|
||||
|
||||
viewLink : String -> Html msg |
||||
viewLink path = |
||||
Html.li [] [ Html.a [ Html.Attributes.href path ] [ Html.text path ] ] |
||||
@ -0,0 +1,55 @@ |
||||
module Style exposing (..) |
||||
|
||||
import Color |
||||
import Color.Manipulate |
||||
import Element exposing (..) |
||||
import Element.Background as Background |
||||
import Element.Border as Border |
||||
import Element.Input as Input |
||||
|
||||
|
||||
{-| HSL = 155, 43.5, 57.6 |
||||
-} |
||||
echoVert = |
||||
Color.fromRgba |
||||
{ red = 100 / 255 |
||||
, green = 194 / 255 |
||||
, blue = 155 / 255 |
||||
, alpha = 255 / 255 |
||||
} |
||||
|
||||
|
||||
vert t = |
||||
fromRgb <| |
||||
Color.toRgba <| |
||||
Color.Manipulate.lighten t echoVert |
||||
|
||||
|
||||
petitEspacement = |
||||
20 |
||||
|
||||
|
||||
grandEspacement = |
||||
5 * petitEspacement // 4 |
||||
|
||||
|
||||
tresGrandEspacement = |
||||
25 * petitEspacement // 16 |
||||
|
||||
|
||||
bouton fonction label = |
||||
Input.button |
||||
[ centerY |
||||
, padding petitEspacement |
||||
, Background.color <| vert -0.2 |
||||
, Border.rounded 8 |
||||
, Border.shadow |
||||
{ blur = 10 |
||||
, color = rgb255 10 10 10 |
||||
, offset = ( 0.3, 0.4 ) |
||||
, size = 2 |
||||
} |
||||
] |
||||
{ onPress = Just fonction |
||||
, label = text label |
||||
} |
||||
Loading…
Reference in new issue