Skip to content

Commit

Permalink
Move live ranking styles to own component and create component for no…
Browse files Browse the repository at this point in the history
… finishes info
  • Loading branch information
araszka committed Aug 10, 2024
1 parent d6ffc45 commit 8f166f9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<component>
<import component="EvoSC.Style.UIStyle" as="UIStyle"/>

<template>
<UIStyle/>
<stylesheet>
<style
class="lr-body-primary"
bgcolor="{{ Theme.UI_LiveRankingModule_Widget_RowBg }}"
opacity="0.9"
/>
<style
class="lr-body-highlight"
bgcolor="{{ Theme.UI_LiveRankingModule_Widget_RowBgHighlight }}"
opacity="0.9"
/>
</stylesheet>
</template>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<component>
<property type="double" name="width" default="36"/>
<property type="string" name="position" default="right"/>

<template>
<frame>
<quad pos='{{ position == "right" ? width + 0.7 : 0 }}'
bgcolor="{{ Theme.UI_AccentPrimary }}"
size="0.7 9"
halign='{{ position }}'
/>
<Panel
width="{{ width }}"
height="9"
x='{{ position == "right" ? 0 : 0.7 }}'
className="lr-body-primary"
bgColor=""
>
<label
class="text-primary"
text="No finishes"
valign="center"
halign="center"
pos="18 -4.2"
size="{{ width }} 9"
/>
</Panel>
</frame>
</template>
</component>
50 changes: 9 additions & 41 deletions src/Modules/LiveRankingModule/Templates/LiveRanking.mt
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,35 @@

<import component="EvoSC.Containers.Widget" as="Widget"/>
<import component="EvoSC.Controls.Panel" as="Panel"/>
<import component="EvoSC.Style.UIStyle" as="UIStyle"/>
<import component="LiveRankingModule.Components.RecordRow" as="RecordRow"/>
<import component="LiveRankingModule.Components.LiveRankingRecordRow" as="LiveRankingRecordRow"/>
<import component="LiveRankingModule.Components.LiveRankingStyles" as="LiveRankingStyles"/>
<import component="LiveRankingModule.Components.NoFinishesBox" as="NoFinishesBox"/>

<property type="ILiveRankingSettings" name="settings"/>
<property type="IEnumerable<LiveRankingPosition>" name="scores"/>
<property type="bool" name="isPointsBased"/>

<template>
<UIStyle/>
<stylesheet>
<style
class="lr-body-primary"
bgcolor="{{ Theme.UI_LiveRankingModule_Widget_RowBg }}"
opacity="0.9"
/>

<style
class="lr-body-highlight"
bgcolor="{{ Theme.UI_LiveRankingModule_Widget_RowBgHighlight }}"
opacity="0.9"
/>
</stylesheet>
<LiveRankingStyles/>
<Widget header="Live Ranking"
height="10"
bodyStyle="unstyled"
position="{{ settings.Position }}"
y="{{ settings.Y }}"
>
<template slot="body">
<RecordRow foreach="LiveRankingPosition score in scores"
<LiveRankingRecordRow foreach="LiveRankingPosition score in scores"
y="{{ -__index*(4+0.3) }}"
pos="{{ __index + 1 }}"
name="{{ score.Name }}"
time="{{ RaceTime.FromMilliseconds(score.Time) }}"
points="{{ score.Points }}"
usePoints="{{ isPointsBased }}"
/>

<frame if="scores.Count() == 0">
<quad pos='{{ settings.Position == "right" ? settings.Width + 0.7 : 0 }}'
bgcolor="{{ Theme.UI_AccentPrimary }}"
size="0.7 9"
halign='{{ settings.Position }}'
/>
<Panel
width="{{ settings.Width }}"
height="9"
x='{{ settings.Position == "right" ? 0 : 0.7}}'
className="lr-body-primary"
bgColor=""
>
<label
class="text-primary"
text="No finishes"
valign="center"
halign="center"
pos="18 -4.2"
size="36 9"
/>
</Panel>
</frame>
<NoFinishesBox if="scores.Count() == 0"
width="{{ settings.Width }}"
position="{{ settings.Position }}"
/>
</template>
</Widget>
</template>
Expand Down

0 comments on commit 8f166f9

Please sign in to comment.