docs: update Readme
This commit is contained in:
parent
55b36e5e62
commit
ccae467ceb
29 changed files with 5012 additions and 4397 deletions
99
frontend/src/View/Components/Navigation.elm
Normal file
99
frontend/src/View/Components/Navigation.elm
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
module View.Components.Navigation exposing (viewDayMobile, viewWeekNavigation)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (..)
|
||||
import Types.Model exposing (Model, Schedule)
|
||||
import Types.Msg exposing (Msg(..))
|
||||
import View.Components.Schedule exposing (viewScheduleItemWithDay)
|
||||
|
||||
|
||||
viewWeekNavigation : Model -> Html Msg
|
||||
viewWeekNavigation model =
|
||||
let
|
||||
dateRange =
|
||||
case model.weekDates of
|
||||
Just wd ->
|
||||
wd.range
|
||||
|
||||
Nothing ->
|
||||
"Laden..."
|
||||
in
|
||||
div [ class "box" ]
|
||||
[ nav [ class "level" ]
|
||||
[ div [ class "level-left" ]
|
||||
[ div [ class "level-item" ]
|
||||
[ button
|
||||
[ class "button is-primary"
|
||||
, onClick PreviousWeek
|
||||
]
|
||||
[ span [ class "icon" ]
|
||||
[ i [ class "fas fa-chevron-left" ] [] ]
|
||||
, span [] [ text "Vorherige Woche" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "level-item" ]
|
||||
[ div
|
||||
[ style "display" "flex"
|
||||
, style "flex-direction" "column"
|
||||
, style "align-items" "center"
|
||||
, style "gap" "0.5rem"
|
||||
, style "min-width" "250px"
|
||||
]
|
||||
[ p
|
||||
[ class "heading"
|
||||
, style "margin" "0"
|
||||
, style "line-height" "1.2"
|
||||
]
|
||||
[ text "Kalenderwoche" ]
|
||||
, p
|
||||
[ class "title is-3"
|
||||
, style "margin" "0"
|
||||
, style "line-height" "1.2"
|
||||
]
|
||||
[ text ("KW " ++ String.fromInt model.currentWeek ++ " / " ++ String.fromInt model.currentYear) ]
|
||||
, p
|
||||
[ class "subtitle is-6"
|
||||
, style "margin" "0"
|
||||
, style "line-height" "1.2"
|
||||
]
|
||||
[ text dateRange ]
|
||||
]
|
||||
]
|
||||
, div [ class "level-right" ]
|
||||
[ div [ class "level-item" ]
|
||||
[ button
|
||||
[ class "button is-primary"
|
||||
, onClick NextWeek
|
||||
]
|
||||
[ span [] [ text "Nächste Woche" ]
|
||||
, span [ class "icon" ]
|
||||
[ i [ class "fas fa-chevron-right" ] [] ]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewDayMobile : Model -> String -> ( Int, List Schedule ) -> Html Msg
|
||||
viewDayMobile model dayName ( dayOfWeek, schedules ) =
|
||||
let
|
||||
dateForDay =
|
||||
case model.weekDates of
|
||||
Just wd ->
|
||||
wd.dates
|
||||
|> List.filter (\( day, _ ) -> day == String.fromInt dayOfWeek)
|
||||
|> List.head
|
||||
|> Maybe.map Tuple.second
|
||||
|> Maybe.withDefault "N/A"
|
||||
|
||||
Nothing ->
|
||||
"Laden..."
|
||||
in
|
||||
div [ class "box mb-4" ]
|
||||
[ p [ class "has-text-weight-bold has-text-centered mb-3" ]
|
||||
[ text (dayName ++ " - " ++ dateForDay) ]
|
||||
, div [] (List.map (viewScheduleItemWithDay model dayOfWeek) schedules)
|
||||
]
|
||||
76
frontend/src/View/Components/Schedule.elm
Normal file
76
frontend/src/View/Components/Schedule.elm
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
module View.Components.Schedule exposing (viewScheduleItemWithDay)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (..)
|
||||
import Types.Model exposing (Model, Schedule)
|
||||
import Types.Msg exposing (Msg(..))
|
||||
|
||||
|
||||
viewScheduleItemWithDay : Model -> Int -> Schedule -> Html Msg
|
||||
viewScheduleItemWithDay model dayOfWeek schedule =
|
||||
let
|
||||
isSelected =
|
||||
List.any (\e -> e.scheduleId == schedule.id && e.dayOfWeek == dayOfWeek) model.selectedEntries
|
||||
|
||||
isClickable =
|
||||
(not model.hasEntriesForCurrentWeek || model.weekEditMode) && not model.isProcessing
|
||||
|
||||
boxClass =
|
||||
if isSelected then
|
||||
"box has-background-success-light"
|
||||
|
||||
else if isClickable then
|
||||
"box has-background-white"
|
||||
|
||||
else
|
||||
"box has-background-light"
|
||||
|
||||
typeText =
|
||||
if schedule.scheduleType == "break" then
|
||||
" (Pause)"
|
||||
|
||||
else
|
||||
""
|
||||
|
||||
cursorStyle =
|
||||
if isClickable then
|
||||
"pointer"
|
||||
|
||||
else
|
||||
"not-allowed"
|
||||
|
||||
opacity =
|
||||
if isClickable || isSelected then
|
||||
"1"
|
||||
|
||||
else
|
||||
"0.6"
|
||||
in
|
||||
div
|
||||
[ class boxClass
|
||||
, onClick
|
||||
(if isClickable then
|
||||
ToggleScheduleSelection schedule.id dayOfWeek
|
||||
|
||||
else
|
||||
FetchSchedules
|
||||
)
|
||||
, style "cursor" cursorStyle
|
||||
, style "margin-bottom" "0.5rem"
|
||||
, style "padding" "0.75rem"
|
||||
, style "opacity" opacity
|
||||
, style "transition" "all 0.2s ease"
|
||||
, style "border"
|
||||
(if isClickable && not isSelected then
|
||||
"2px solid transparent"
|
||||
|
||||
else
|
||||
"2px solid currentColor"
|
||||
)
|
||||
]
|
||||
[ p [ class "has-text-weight-bold is-size-7" ]
|
||||
[ text (schedule.startTime ++ " - " ++ schedule.endTime) ]
|
||||
, p [ class "is-size-7" ]
|
||||
[ text (schedule.title ++ typeText) ]
|
||||
]
|
||||
66
frontend/src/View/Components/Toast.elm
Normal file
66
frontend/src/View/Components/Toast.elm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
module View.Components.Toast exposing (viewToasts)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (..)
|
||||
import Types.Model exposing (Model, Schedule, Toast, ToastType(..))
|
||||
import Types.Msg exposing (Msg(..))
|
||||
import Utils.TimeUtils exposing (calculateHours)
|
||||
import View.Components.Navigation exposing (viewDayMobile, viewWeekNavigation)
|
||||
import View.Components.Schedule exposing (viewScheduleItemWithDay)
|
||||
|
||||
|
||||
viewToasts : List Toast -> Html Msg
|
||||
viewToasts toasts =
|
||||
div [ class "toast-container" ]
|
||||
(List.map viewToast toasts)
|
||||
|
||||
|
||||
viewToast : Toast -> Html Msg
|
||||
viewToast toast =
|
||||
let
|
||||
toastClass =
|
||||
case toast.toastType of
|
||||
ErrorToast ->
|
||||
"toast-error"
|
||||
|
||||
SuccessToast ->
|
||||
"toast-success"
|
||||
|
||||
InfoToast ->
|
||||
"toast-info"
|
||||
|
||||
WarningToast ->
|
||||
"toast-warning"
|
||||
|
||||
icon =
|
||||
case toast.toastType of
|
||||
ErrorToast ->
|
||||
"fas fa-exclamation-circle"
|
||||
|
||||
SuccessToast ->
|
||||
"fas fa-check-circle"
|
||||
|
||||
InfoToast ->
|
||||
"fas fa-info-circle"
|
||||
|
||||
WarningToast ->
|
||||
"fas fa-exclamation-triangle"
|
||||
in
|
||||
div [ class ("toast " ++ toastClass), style "animation" "slideIn 0.3s ease-out" ]
|
||||
[ div [ class "toast-content" ]
|
||||
[ span [ class "toast-icon" ]
|
||||
[ i [ class icon ] [] ]
|
||||
, span [ class "toast-message" ] [ text toast.message ]
|
||||
]
|
||||
, if toast.dismissible then
|
||||
button
|
||||
[ class "toast-close"
|
||||
, onClick (DismissToast toast.id)
|
||||
, attribute "aria-label" "Schließen"
|
||||
]
|
||||
[ i [ class "fas fa-times" ] [] ]
|
||||
|
||||
else
|
||||
text ""
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue