Make it look more like Minsuk's version.
This commit is contained in:
parent
3a237d0d0e
commit
69f8de7f2e
4
elm.json
4
elm.json
|
@ -8,10 +8,12 @@
|
||||||
"direct": {
|
"direct": {
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
"elm/html": "1.0.0"
|
"elm/html": "1.0.0",
|
||||||
|
"feathericons/elm-feather": "1.5.0"
|
||||||
},
|
},
|
||||||
"indirect": {
|
"indirect": {
|
||||||
"elm/json": "1.1.3",
|
"elm/json": "1.1.3",
|
||||||
|
"elm/svg": "1.0.1",
|
||||||
"elm/time": "1.0.0",
|
"elm/time": "1.0.0",
|
||||||
"elm/url": "1.0.0",
|
"elm/url": "1.0.0",
|
||||||
"elm/virtual-dom": "1.0.2"
|
"elm/virtual-dom": "1.0.2"
|
||||||
|
|
|
@ -96,8 +96,8 @@ body {
|
||||||
.week-grid {
|
.week-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50vh;
|
height: 70vh;
|
||||||
grid-template-columns: auto repeat(7, 1fr);
|
grid-template-columns: auto repeat(5, 1fr);
|
||||||
grid-template-rows: auto repeat(10, 1fr);
|
grid-template-rows: auto repeat(10, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,13 +107,19 @@ body {
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
padding: 0.25rem;
|
padding: 0.25rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
&.selected {
|
&.selected {
|
||||||
border-style: dashed;
|
border-style: dashed;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 0.1rem;
|
||||||
|
margin-bottom: 0.1rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-container {
|
.column-container {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module ClassSchedule.View exposing (..)
|
module ClassSchedule.View exposing (..)
|
||||||
import ClassSchedule.Model exposing (..)
|
import ClassSchedule.Model exposing (..)
|
||||||
import Html exposing (Html, Attribute, div, text, table, td, th, tr, span, input, h1)
|
import Html exposing (Html, Attribute, div, text, table, td, th, tr, span, input, h1, p)
|
||||||
import Html.Attributes exposing (class, classList, type_, style)
|
import Html.Attributes exposing (class, classList, type_, style)
|
||||||
import Html.Events exposing (onClick)
|
import Html.Events exposing (onClick, onInput)
|
||||||
import Tuple exposing (..)
|
import Tuple exposing (..)
|
||||||
import Dict exposing (..)
|
import Dict exposing (..)
|
||||||
import FeatherIcons
|
import FeatherIcons
|
||||||
|
@ -110,14 +110,14 @@ viewClassTable sel =
|
||||||
|
|
||||||
viewToolbar : Model -> Html Msg
|
viewToolbar : Model -> Html Msg
|
||||||
viewToolbar m = div []
|
viewToolbar m = div []
|
||||||
[ span [] [ text "Search: " , input [ type_ "text" ] [] ]
|
[ span [] [ text "Search: " , input [ type_ "text", onInput SearchInput ] [] ]
|
||||||
]
|
]
|
||||||
|
|
||||||
viewClassList : Model -> Html Msg
|
viewClassList : Model -> Html Msg
|
||||||
viewClassList m = div []
|
viewClassList m = div []
|
||||||
[ viewToolbar m
|
[ viewToolbar m
|
||||||
, case get (m.term) (m.terms) of
|
, case get (m.term) (m.terms) of
|
||||||
Just cs -> viewClassTable (m.selected) cs
|
Just cs -> viewClassTable (m.selected) <| List.filter (courseContains m.searchInput) cs
|
||||||
Nothing -> text "Please select a term!"
|
Nothing -> text "Please select a term!"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -214,6 +214,9 @@ groupDims l =
|
||||||
days : List DayOfWeek
|
days : List DayOfWeek
|
||||||
days = [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
|
days = [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
|
||||||
|
|
||||||
|
courseContains : String -> (CourseStatus, Course) -> Bool
|
||||||
|
courseContains s (_, c) = String.contains s (viewCrn c.crn) || String.contains s c.name || List.any (String.contains s) c.instructors
|
||||||
|
|
||||||
buildCellDict : Maybe Int -> List (CourseStatus, Course) -> Dict Int (Dict Int (List (Course, CellInfo)))
|
buildCellDict : Maybe Int -> List (CourseStatus, Course) -> Dict Int (Dict Int (List (Course, CellInfo)))
|
||||||
buildCellDict ms l =
|
buildCellDict ms l =
|
||||||
let
|
let
|
||||||
|
@ -225,8 +228,8 @@ buildCellDict ms l =
|
||||||
in
|
in
|
||||||
List.foldl Dict.union Dict.empty <| List.indexedMap singleDay days
|
List.foldl Dict.union Dict.empty <| List.indexedMap singleDay days
|
||||||
|
|
||||||
viewCourseBlock : CellInfo -> String -> Html Msg
|
viewCourseBlock : CellInfo -> Course -> Html Msg
|
||||||
viewCourseBlock ci s =
|
viewCourseBlock ci c =
|
||||||
let
|
let
|
||||||
ps f = String.fromFloat f ++ "%"
|
ps f = String.fromFloat f ++ "%"
|
||||||
nw = if (ci.width) == 100.0 then 100.0 else (ci.width)*0.95
|
nw = if (ci.width) == 100.0 then 100.0 else (ci.width)*0.95
|
||||||
|
@ -239,7 +242,9 @@ viewCourseBlock ci s =
|
||||||
, style "top" (ps (ci.verticalOffset))
|
, style "top" (ps (ci.verticalOffset))
|
||||||
, classList [("selected", sel), ("color-green", ad == Added)]
|
, classList [("selected", sel), ("color-green", ad == Added)]
|
||||||
]
|
]
|
||||||
[ text s ]
|
[ p [] [ text <| viewCrn <| c.crn ]
|
||||||
|
, p [] [ text <| c.name ]
|
||||||
|
]
|
||||||
|
|
||||||
viewTableDayHeader : DayOfWeek -> Html Msg
|
viewTableDayHeader : DayOfWeek -> Html Msg
|
||||||
viewTableDayHeader dw = span [ class "table-day-header" ] [ text <| viewDayCode dw ]
|
viewTableDayHeader dw = span [ class "table-day-header" ] [ text <| viewDayCode dw ]
|
||||||
|
@ -247,12 +252,12 @@ viewTableDayHeader dw = span [ class "table-day-header" ] [ text <| viewDayCode
|
||||||
viewClassSchedule : Model -> Html Msg
|
viewClassSchedule : Model -> Html Msg
|
||||||
viewClassSchedule m =
|
viewClassSchedule m =
|
||||||
let
|
let
|
||||||
header = span [] [] :: List.map viewTableDayHeader days
|
header = span [] [] :: List.map viewTableDayHeader (List.take 5 days)
|
||||||
cellDict = buildCellDict m.selected (Maybe.withDefault [] <| Dict.get m.term m.terms)
|
cellDict = buildCellDict m.selected (Maybe.withDefault [] <| Dict.get m.term m.terms)
|
||||||
times = List.range 0 10
|
times = List.range 0 10
|
||||||
time h = List.map (\w -> Maybe.withDefault [] <| Maybe.andThen (Dict.get h) <| Dict.get w cellDict) (List.range 0 6)
|
time h = List.map (\w -> Maybe.withDefault [] <| Maybe.andThen (Dict.get h) <| Dict.get w cellDict) (List.range 0 4)
|
||||||
container xs = div [ class "column-container" ] <|
|
container xs = div [ class "column-container" ] <|
|
||||||
List.map (\(c, ci) -> viewCourseBlock ci (viewCrn c.crn)) xs
|
List.map (\(c, ci) -> viewCourseBlock ci c) xs
|
||||||
in
|
in
|
||||||
Debug.log (Debug.toString cellDict) <| div [ class "table-wrapper", style "width" "100%", style "padding" "1rem" ]
|
Debug.log (Debug.toString cellDict) <| div [ class "table-wrapper", style "width" "100%", style "padding" "1rem" ]
|
||||||
[ div [ class "week-grid" ] <|
|
[ div [ class "week-grid" ] <|
|
||||||
|
|
51
src/Main.elm
51
src/Main.elm
|
@ -22,35 +22,35 @@ onDays dds (t1, t2) = List.map (\d -> (d, t1, t2)) dds
|
||||||
|
|
||||||
classes : List Course
|
classes : List Course
|
||||||
classes =
|
classes =
|
||||||
[ { crn = (ComputerScience, 544)
|
[ { crn = (ComputerScience, 517)
|
||||||
, name = "Operating Systems II"
|
, name = "Theory of Comp"
|
||||||
, instructors = ["Yeongjin Jang"]
|
, instructors = ["Mike Rosulek"]
|
||||||
, times = onDays [Tuesday, Thursday] <| oneHour <| nAm 8
|
, times = onDays [Monday, Wednesday, Friday] <| oneHour <| nPm 2
|
||||||
}
|
}
|
||||||
, { crn = (ComputerScience, 480)
|
, { crn = (ComputerScience, 531)
|
||||||
, name = "Translators"
|
, name = "Artificial Intelligence"
|
||||||
, instructors = ["Rob Hess"]
|
, instructors = ["John Doe"]
|
||||||
, times = onDays [Tuesday, Thursday] <| oneHour <| nAm 10
|
, times = onDays [Monday, Wednesday, Friday] <| oneHour <| nPm 0
|
||||||
}
|
}
|
||||||
, { crn = (ComputerScience, 583)
|
, { crn = (ComputerScience, 533)
|
||||||
, name = "Advanced Functional Programming"
|
, name = "Intelligent Somethings"
|
||||||
, instructors = ["Eric Walkingshaw"]
|
, instructors = ["Alan Fern"]
|
||||||
, times = onDays [Monday, Wednesday] <| oneHour <| nAm 10
|
|
||||||
}
|
|
||||||
, { crn = (ComputerScience, 583)
|
|
||||||
, name = "Advanced Functional Programming"
|
|
||||||
, instructors = ["Eric Walkingshaw"]
|
|
||||||
, times = onDays [Monday, Wednesday] <| oneHour <| nAm 11
|
|
||||||
}
|
|
||||||
, { crn = (ComputerScience, 583)
|
|
||||||
, name = "Advanced Functional Programming"
|
|
||||||
, instructors = ["Eric Walkingshaw"]
|
|
||||||
, times = onDays [Monday, Wednesday] <| twoHours <| nAm 10
|
, times = onDays [Monday, Wednesday] <| twoHours <| nAm 10
|
||||||
}
|
}
|
||||||
, { crn = (ComputerScience, 582)
|
, { crn = (ComputerScience, 535)
|
||||||
, name = "Programming Languages II"
|
, name = "Deep Learning"
|
||||||
, instructors = ["Martin Erwig"]
|
, instructors = ["F. Li"]
|
||||||
, times = onDays [Monday, Wednesday] <| oneHour <| nPm 4
|
, times = onDays [Tuesday, Thursday] <| twoHours <| nPm 2
|
||||||
|
}
|
||||||
|
, { crn = (ComputerScience, 551)
|
||||||
|
, name = "Computer Graphics"
|
||||||
|
, instructors = ["Mike Bailey"]
|
||||||
|
, times = onDays [Monday, Wednesday] <| twoHours <| nPm 0
|
||||||
|
}
|
||||||
|
, { crn = (ComputerScience, 565)
|
||||||
|
, name = "Human-Computer Interaction"
|
||||||
|
, instructors = ["Minsuk Kahng"]
|
||||||
|
, times = onDays [Tuesday, Thursday] <| twoHours <| nPm 4
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ update msg m =
|
||||||
SelectCourse i -> ({ m | selected = Just i}, Cmd.none)
|
SelectCourse i -> ({ m | selected = Just i}, Cmd.none)
|
||||||
AddCourse i -> (modifyCurrent (changeCourse i Added) m, Cmd.none)
|
AddCourse i -> (modifyCurrent (changeCourse i Added) m, Cmd.none)
|
||||||
RemoveCourse i -> (modifyCurrent (changeCourse i NotAdded) m, Cmd.none)
|
RemoveCourse i -> (modifyCurrent (changeCourse i NotAdded) m, Cmd.none)
|
||||||
|
SearchInput s -> ({ m | searchInput = s }, Cmd.none)
|
||||||
_ -> (m, Cmd.none)
|
_ -> (m, Cmd.none)
|
||||||
|
|
||||||
subscriptions : Model -> Sub Msg
|
subscriptions : Model -> Sub Msg
|
||||||
|
|
Loading…
Reference in New Issue
Block a user