#:import _ electrum.gui.kivy.i18n._
#:import KIVY_GUI_PATH electrum.gui.kivy.KIVY_GUI_PATH
#:import Factory kivy.factory.Factory



<CardLabel@Label>
    color: .7, .7, .7, 1
    text_size: self.width, None
    #height: self.texture_size[1]
    halign: 'left'
    valign: 'top'


<HistoryItem@CardItem>
    icon: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important'
    message: ''
    fee_text: ''
    is_mine: True
    amount: '--'
    amount_color: '#FF6657' if self.is_mine else '#2EA442'
    date: ''
    quote_text: ''
    amount_str: self.quote_text if app.is_fiat else self.amount
    base_unit: ''
    fx_ccy: ''
    unit_str: self.fx_ccy if app.is_fiat else self.base_unit
    Image:
        id: icon
        source: root.icon
        size_hint: None, 1
        allow_stretch: True
        width: self.height*1.5
        mipmap: True
    BoxLayout:
        spacing: '8dp'
        height: '32dp'
        orientation: 'vertical'
        Widget
        CardLabel:
            color: 0.95, 0.95, 0.95, 1
            text: root.message
            shorten: True
            shorten_from: 'right'
            font_size: '15sp'
        Widget
        CardLabel:
            font_size: '12sp'
            shorten: True
            text: root.date
        Widget
    BoxLayout:
        spacing: '8dp'
        height: '32dp'
        orientation: 'vertical'
        Widget
        CardLabel:
            text: u'[color={color}]{s}[/color]'.format(s=root.amount_str, color=root.amount_color) + ' ' + '[size=12sp]' + root.unit_str + '[/size]'
            halign: 'right'
            font_size: '15sp'
        Widget
        CardLabel:
            text: root.fee_text
            halign: 'right'
            font_size: '12sp'
        Widget

<HistoryRecycleView>:
    viewclass: 'HistoryItem'
    RecycleBoxLayout:
        default_size: None, dp(56)
        default_size_hint: 1, None
        size_hint: 1, None
        height: self.minimum_height
        orientation: 'vertical'


<HistoryScreen>:
    name: 'history'
    content: history_container
    BoxLayout:
        orientation: 'vertical'
        Button:
            background_color: 0, 0, 0, 0
            text: app.fiat_balance if app.is_fiat else app.balance
            markup: True
            color: .9, .9, .9, 1
            font_size: '30dp'
            bold: True
            size_hint: 1, 0.25
            on_release: app.is_fiat = not app.is_fiat if app.fx.is_enabled() else False
        HistoryRecycleView:
            id: history_container
            scroll_type: ['bars', 'content']
            bar_width: '25dp'
