<commit_before>{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Lib
    ( someFunc
    ) where

import           Reflex.Dom
import           Data.JSString ()
import           GHCJS.Types
import           GUI.ChannelDrawer
import           GUI.Player
import           GUI.Utilities

someFunc :: IO ()
someFunc = mainWidget mainUI

-- Needed until Reflex.Dom version 0.4 is released
foreign import javascript unsafe
  "$1.withCredentials = true;"
  setRequestWithCredentials :: JSVal -> IO ()

tvhBaseUrl :: String
tvhBaseUrl = "http://localhost:9981/"

mainUI :: MonadWidget t m => m ()
mainUI =
  -- We need to have this outer main div, as MDL would otherwise try to access a
  -- parent that does not exist
  el "div" $ do
    matDivClass "mdl-layout mdl-js-layout mdl-layout--fixed-drawer" $ do
      -- create the channel drawer and react to events fired when a channel is selected
      curChannel <- channelDrawer tvhBaseUrl
      matElClass "main" "mdl-layout__content" $ do
        player tvhBaseUrl curChannel<commit_msg>add a header displaying the app title<commit_after>{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Lib
    ( someFunc
    ) where

import           Reflex.Dom
import           Data.JSString ()
import           GHCJS.Types
import           GUI.ChannelDrawer
import           GUI.Player
import           GUI.Utilities

someFunc :: IO ()
someFunc = mainWidget mainUI

-- Needed until Reflex.Dom version 0.4 is released
foreign import javascript unsafe
  "$1.withCredentials = true;"
  setRequestWithCredentials :: JSVal -> IO ()

tvhBaseUrl :: String
tvhBaseUrl = "http://localhost:9981/"

header :: MonadWidget t m => m ()
header = do
  matElClass "header" "mdl-layout__header" $ do
    matDivClass "mdl-layout__header-row" $ do
      matElClass "span" "mdl-layout__title" $ text "Tvheadend frontend"
      matDivClass "mdl-layout-spacer" blank

mainUI :: MonadWidget t m => m ()
mainUI =
  -- We need to have this outer main div, as MDL would otherwise try to access a
  -- parent that does not exist
  el "div" $ do
    matDivClass "mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header" $ do
      header

      -- create the channel drawer and react to events fired when a channel is selected
      curChannel <- channelDrawer tvhBaseUrl

      matElClass "main" "mdl-layout__content" $ do
        player tvhBaseUrl curChannel
{'fraction_non_alphanumeric': 0.08558371416701288, 'fraction_numerical': 0.005816368923971749, 'mean_word_length': 2.8713826366559485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1937605', 'n_tokens_mistral': 731, 'n_tokens_neox': 715, 'n_words': 238}