<commit_before>module Widget where

import Import

import Data.Lens.Common

import Lol.Stats
import Lol.Stats.Types

coreStatsWidget :: CoreStats -> Widget
coreStatsWidget cs = [whamlet|
<ul>
    <li>Health: #{getL csHealth cs}
    <li>Mana: #{getL csMana cs}
    <li>Health Regen: #{getL csHealthRegen cs}
    <li>Mana Regen: #{getL csManaRegen cs}
    <li>AD: #{getL csAttackDamage cs}
    <li>Armor: #{getL csArmor cs}
    <li>MR: #{getL csMagicResist cs}
    <li>AS: #{getL csAttackSpeed cs}
    <li>Movement Speed: #{getL csMovementSpeed cs}
    <li>Range: #{getL csRange cs}
|]

-- | Display extended statistics.
--   The first boolean parameter determines whether bonuses are displayed.
--   Items probably want it, champions probably don't.
extendedStatsWidget :: Bool -> ExtendedStats -> Widget
extendedStatsWidget bonuses es = [whamlet|
<ul>
    <li>AP: #{getL esAbilityPower es}
    <li>Lifesteal: #{getL esLifeSteal es}
    <li>Vamp: #{getL esSpellVamp es}
    <li>Crit Chance: #{getL esCriticalChance es}
    $if bonuses
    <li>Bonus MS: #{getL esBonusMovementSpeed es}
|]

champStatsWidget :: ChampStats -> Widget
champStatsWidget cs = [whamlet|
<h2>Champion Stats
^{coreStatsWidget $ getL cCoreStats cs}
^{extendedStatsWidget False $ getL cExtendedStats cs}
|]

itemStatsWidget :: ItemStats -> Widget
itemStatsWidget is = [whamlet|
<h2>Item Stats<commit_msg>Widget: Fix bonus MS display on champions.<commit_after>module Widget where

import Import

import Data.Lens.Common

import Lol.Stats
import Lol.Stats.Types

coreStatsWidget :: CoreStats -> Widget
coreStatsWidget cs = [whamlet|
<ul>
    <li>Health: #{getL csHealth cs}
    <li>Mana: #{getL csMana cs}
    <li>Health Regen: #{getL csHealthRegen cs}
    <li>Mana Regen: #{getL csManaRegen cs}
    <li>AD: #{getL csAttackDamage cs}
    <li>Armor: #{getL csArmor cs}
    <li>MR: #{getL csMagicResist cs}
    <li>AS: #{getL csAttackSpeed cs}
    <li>Movement Speed: #{getL csMovementSpeed cs}
    <li>Range: #{getL csRange cs}
|]

-- | Display extended statistics.
--   The first boolean parameter determines whether bonuses are displayed.
--   Items probably want it, champions probably don't.
extendedStatsWidget :: Bool -> ExtendedStats -> Widget
extendedStatsWidget bonuses es = [whamlet|
<ul>
    <li>AP: #{getL esAbilityPower es}
    <li>Lifesteal: #{getL esLifeSteal es}
    <li>Vamp: #{getL esSpellVamp es}
    <li>Crit Chance: #{getL esCriticalChance es}
    $if bonuses
        <li>Bonus MS: #{getL esBonusMovementSpeed es}
|]

champStatsWidget :: ChampStats -> Widget
champStatsWidget cs = [whamlet|
<h2>Champion Stats
^{coreStatsWidget $ getL cCoreStats cs}
^{extendedStatsWidget False $ getL cExtendedStats cs}
|]

itemStatsWidget :: ItemStats -> Widget
itemStatsWidget is = [whamlet|
<h2>Item Stats
{'fraction_non_alphanumeric': 0.11794318590435095, 'fraction_numerical': 0.001438331535418914, 'mean_word_length': 4.370656370656371, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 51, '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': '37813', 'n_tokens_mistral': 1000, 'n_tokens_neox': 977, 'n_words': 281}