Skip to content

Commit

Permalink
live page: update
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tsien <[email protected]>
  • Loading branch information
bekcpear committed Aug 20, 2024
1 parent 7d2c7a0 commit 8410d3d
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 9 deletions.
3 changes: 3 additions & 0 deletions assets/ananke/css/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ body:not(.in-home) {
}
div.other {
background: #bde6f0;
&.other-spec {
background: #fbcd69;
}
}
div.check {
background: #2cd67f;
Expand Down
12 changes: 12 additions & 0 deletions content/en/live.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ methods:
a0821: true
a0822: true
a0823: true
- name: XuanTie 玄铁
mobile_only: false
platforms:
- name: WeChat Channel
cname: XuanTie玄铁
a0821:
separatedMethod: ampmspec
am:
other: "10:10 - 10:30"
pm: false
a0822: false
a0823: false
- name: AEIC 学术交流中心
platforms:
- name: WeChat Channel
Expand Down
12 changes: 12 additions & 0 deletions content/zh/live.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ methods:
a0821: true
a0822: true
a0823: true
- name: XuanTie 玄铁
mobile_only: false
platforms:
- name: 微信视频号
cname: XuanTie玄铁
a0821:
separatedMethod: ampmspec
am:
other: "10:10 - 10:30"
pm: false
a0822: false
a0823: false
- name: AEIC 学术交流中心
platforms:
- name: 微信视频号
Expand Down
3 changes: 3 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ other = "No streaming"
[live_other_desc]
other = "Co-events streaming"

[live_other_spec_desc]
other = "Streaming on specified duration"

[am]
other = "a.m."

Expand Down
3 changes: 3 additions & 0 deletions i18n/zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ other = "无直播"
[live_other_desc]
other = "相应同期活动直播"

[live_other_spec_desc]
other = "特定时间段的直播"

[am]
other = "上午"

Expand Down
17 changes: 12 additions & 5 deletions layouts/page/live.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ <h1 class="f1 mt3 mb1">
</div>
<div class="symbol-info">
<div class="row">
<div class="symbol check"></div><div>{{i18n "live_check_desc"}}</div>
<div class="symbol check"></div><div>{{i18n "live_check_desc"}}</div>
</div>
<div class="row">
<div class="symbol uncheck"></div><div>{{i18n "live_uncheck_desc"}}</div>
<div class="symbol uncheck"></div><div>{{i18n "live_uncheck_desc"}}</div>
</div>
<div class="row">
<div class="symbol other"></div><div>{{i18n "live_other_desc"}}</div>
<div class="symbol other"></div><div>{{i18n "live_other_desc"}}</div>
</div>
<div class="row">
<div class="symbol other other-spec"></div><div>{{i18n "live_other_spec_desc"}}</div>
</div>
</div>
<table>
Expand Down Expand Up @@ -114,6 +117,7 @@ <h1 class="f1 mt3 mb1">
{{- $vaCoEvents := slice }}
{{- $pushedPlatforms := slice }}
{{- $pushedCoEvents := slice }}
{{- $pushedSpecDurations := slice }}
{{- $coEventsPerPlatform := dict }}
{{- range $val.platforms }}
{{- $va := slice (dict "dataOnly" true "pName" .name "d" .a0821 "id" "a0821" "ampm" (slice "am" "pm") "ab" (slice "")) }}
Expand All @@ -123,8 +127,11 @@ <h1 class="f1 mt3 mb1">
{{- range $ampm := $val.ampm }}
{{- range $val.ab }}
{{- $newVal := partial "func/liveStat.html" (merge $val (dict "ab" . "ampm" $ampm)) }}
{{- if and (and $newVal (eq $newVal.code 3)) (not (in $pushedCoEvents $newVal.text)) }}
{{- if and (and $newVal (or (eq $newVal.code 3) (eq $newVal.code 4))) (not (in $pushedCoEvents $newVal.text)) }}
{{- $pushedCoEvents = append $newVal.text $pushedCoEvents }}
{{- if not (in $pushedSpecDurations $newVal.text) }}
{{- $pushedSpecDurations = append $newVal.text $pushedSpecDurations }}
{{- end }}
{{- if not (in $pushedPlatforms $newVal.pName) }}
{{- $pushedPlatforms = append $newVal.pName $pushedPlatforms }}
{{- end }}
Expand All @@ -144,7 +151,7 @@ <h1 class="f1 mt3 mb1">
{{- if gt (len $pushedPlatforms) 1 }}
<td class="o-name">{{.pName}}</td>
{{- end }}
<td class="stat {{if gt (index $coEventsPerPlatform (sha1 .pName)) 1 }}show-label{{end}} {{.id}}{{.ab}} {{.ampm}}"><div class="other"></div></td>
<td class="stat {{if gt (index $coEventsPerPlatform (sha1 .pName)) 1 }}show-label{{end}} {{.id}}{{.ab}} {{.ampm}}"><div class="other {{if eq .code 4}}other-spec{{end}}"></div></td>
<td class="desc">{{.text}}</td>
</tr>
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/func/liveStat-ab.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
{{ if eq . true }}
{{ $result = merge $result (dict "code" 1) }}
{{ else if .other }}
{{ $result = merge $result (dict "code" 3 "text" .other) }}
{{ $result = merge $result (dict "code" $params.codeForOther "text" .other) }}
{{ end }}
{{ end }}
{{ else if eq $params.ab "b" }}
{{ with .b }}
{{ if eq . true}}
{{ $result = merge $result (dict "code" 1) }}
{{ else if .other }}
{{ $result = merge $result (dict "code" 3 "text" .other) }}
{{ $result = merge $result (dict "code" $params.codeForOther "text" .other) }}
{{ end }}
{{ end }}
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/func/liveStat-ampm.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ if eq . true }}
{{ $result = merge $result (dict "code" 1) }}
{{ else if .other }}
{{ $result = merge $result (dict "code" 3 "text" .other) }}
{{ $result = merge $result (dict "code" $params.codeForOther "text" .other) }}
{{ else if or .a .b }}
{{ $result = merge $result (partial "func/liveStat-ab.html" (merge $params (dict "d" .))) }}
{{ end }}
Expand All @@ -17,7 +17,7 @@
{{ if eq . true }}
{{ $result = merge $result (dict "code" 1) }}
{{ else if .other }}
{{ $result = merge $result (dict "code" 3 "text" .other) }}
{{ $result = merge $result (dict "code" $params.codeForOther "text" .other) }}
{{ else if or .a .b }}
{{ $result = merge $result (partial "func/liveStat-ab.html" (merge $params (dict "d" .))) }}
{{ end }}
Expand Down
6 changes: 6 additions & 0 deletions layouts/partials/func/liveStat.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@
{{ $checkStrFmt := "<td class='%s'><div class='check'></div></td>" }} {{/*result.code: 1*/}}
{{ $uncheckStrFmt := "<td class='%s'><div class='uncheck'></div></td>" }} {{/*result.code: 2*/}}
{{ $otherFmt := "<td colspan='%d' class='%s'><div class='other'>%s</div></td>" }} {{/*result.code: 3*/}}
{{ $otherSpecFmt := "<td class='%s'><div class='other other-spec'>%s</div></td>" }} {{/*result.code: 4*/}}
{{ $defaultClass := "stat" }}

{{ if eq .d true }}
{{ $result = merge $result (dict "code" 1) }}
{{ else }}
{{ $result = merge $result (dict "code" 2) }}
{{ $params = merge $params (dict "codeForOther" 3) }}
{{ with .d }}
{{ if eq .separatedMethod "ampm" }}
{{ $result = merge $result (partial "func/liveStat-ampm.html" $params) }}
{{ else if eq .separatedMethod "ab" }}
{{ $result = merge $result (partial "func/liveStat-ab.html" $params) }}
{{ else if eq .separatedMethod "ampmab" }}
{{ $result = merge $result (partial "func/liveStat-ampm.html" $params) }}
{{ else if eq .separatedMethod "ampmspec" }}
{{ $result = merge $result (partial "func/liveStat-ampm.html" (merge $params (dict "codeForOther" 4))) }}
{{ end }}
{{ end }}
{{ end }}
Expand All @@ -38,6 +42,8 @@
{{ else }}
{{ $resultStr = "" }}
{{ end }}
{{ else if eq $result.code 4 }}
{{ $resultStr = printf $otherSpecFmt (printf "%s %s%s %s" $defaultClass $result.id $result.ab $result.ampm) $result.text | safeHTML }}
{{ else }}
{{ $resultStr = printf "<td class='%s'>unknown</td>" $defaultClass | safeHTML }}
{{ end }}
Expand Down

0 comments on commit 8410d3d

Please sign in to comment.