Commit 40f31212 authored by Martin Alvarez-Espinar's avatar Martin Alvarez-Espinar
Browse files

Sample of athletics long jump

parent 7b4a536b
.quickapp
build
dist
node_modules
fa-toolkit*
MIT License
Copyright (c) 2021 Martin Alvarez-Espinar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Quick App Long Jump Competition
Sample code of a quick app to show real-time results in a long jump athletics competition.
This example was presented during the [AthTech'21 Conference](https://athtech.run/2021) as a proof of concept to easily visualize sports data in real-time.
<img style="height: 500px; border-radius: 6px; border: 1px #333333 solid" src="./longjump.gif" alt="Quick App execution" />
\ No newline at end of file
This diff is collapsed.
{
"name": "es.espinr.longjump",
"version": "1.0.2",
"description": "",
"scripts": {
"fa-build": "node node_modules/webpack/bin/webpack.js --progress --config ./node_modules/fa-toolkit/webpack.config.js",
"fa-watch": "node node_modules/webpack/bin/webpack.js --watch --progress --config ./node_modules/fa-toolkit/webpack.config.js",
"fa-release": "node ./node_modules/cross-env/src/bin/cross-env.js uglifyjs=true sign=release node_modules/webpack/bin/webpack.js --progress --config ./node_modules/fa-toolkit/webpack.config.js"
},
"devDependencies": {
"fa-toolkit": "file:fa-toolkit-11.4.1-Stable.300.tgz",
"cross-env": "^7.0.2"
}
}
<script>
module.exports = {
onCreate() {
console.info('Application onCreate');
},
onDestroy() {
console.info('Application onDestroy');
}
}
</script>
<template>
<div class="card_box">
<div class="card_button_box" for="buttonArray">
<text if="$idx === 0" class="card_button" onclick="pushNotifications"
>{{buttonArray[$idx]}}</text>
<text else class="card_button" onclick="emitEvent"
>{{buttonArray[$idx]}}</text>
</div>
</div>
</template>
<style lang="sass">
.card_box {
height: 44px;
margin-left: 8px;
}
.card_button_box {
height: 42px;
margin-left: 12px;
align-items: center;
}
.card_button {
color: rgb(10, 89, 247);
padding: 4px 0px;
font-size: 14px;
}
.dark .card_button {
color: rgb(82, 146, 255);
}
.card_button:active {
border-radius: 14px;
background-color: rgba(0, 0, 0, 0.096);
}
.dark .card_button:active {
color: rgb(82, 146, 255);
background-color: rgba(255, 255, 255, 0.164);
}
</style>
<script>
import prompt from '@system.prompt';
import notification from '@system.notification';
module.exports = {
props: [
'buttonArray'
],
data: {
buttonArray: []
},
emitEvent() {
prompt.showToast({
message:'Sorry, action not implemented yet',
duration:"100000",
gravity: 'bottom'
});
},
pushNotifications() {
notification.postDelayedShow({
message:{
contentTitle: 'Zadar EAP Meeting (LJ)',
contentText: 'Next jump: MILLER, Linda (USA)',
clickAction: {
uri: '/competition'
}
},
buildInfo:{
latencyTime: 10, // seconds
isPersisted: true
},
success:function(params){
console.info("success, id is "+ params.jobId)
}
});
prompt.showToast({
message:'Next athlete: MILLER, Linda (USA)',
duration:"100000",
image:"./common/user.png",
gravity: 'center'
});
}
}
</script>
\ No newline at end of file
<template>
<div class="{{gridIndex%2===0?'entry_athlete':'entry_athlete stripe'}}">
<div class="athlete_box">
<!--
<text class="athlete_title mr-m HagTextSizeCardList2">{{position}}</text>
-->
<image class="athlete_title_flag" src='https://flagcdn.com/h20/{{gridProfile.country}}.png'></image>
<text class="athlete_name">{{gridProfile.name}}</text>
<text class="athlete_bib">({{gridProfile.bib}})</text>
</div>
<div class="grid_content_box">
<block for="{{gridContent.slice(0,Number(gridContentNumber))}}">
<div class="item" onclick="shareResult($item.attempt, gridProfile.name, $item.measure, position)">
<text class="item_attempt">{{ $item.attempt }}</text>
<stack>
<div class="{{$item.measure===''?'attempt':($item.measure==='X'?'attempt fail':'attempt pass')}}">
<text class="item_measure">{{ $item.measure }}</text>
</div>
</stack>
</div>
</block>
</div>
</div>
</template>
<style lang="sass">
.entry_athlete {
flex-direction: column;
padding: 12px;
}
.stripe {
background-color: rgb(253, 253, 253);
}
.dark .stripe {
background-color: rgb(37, 37, 37);
}
.athlete_box {
height: 16px;
margin-left: 4px;
}
.athlete_title_flag {
height: 16px;
}
.athlete_name, .athlete_bib {
lines: 1;
text-overflow: ellipsis;
font-size: 14px;
margin-left: 8px;
color: rgba(0, 0, 0, 0.897);
}
.dark .athlete_name,
.dark .athlete_bib {
color: rgba(236, 236, 236, 0.979);
}
.grid_content_box {
justify-content: space-around;
align-items: center;
padding: 0 12px 0px 12px;
}
.item {
flex:1;
height: 100%;
flex-direction: column;
align-items: center;
padding: 4px;
}
.item:active {
height: 100%;
flex-direction: column;
align-items: center;
background-color: rgba(0, 0, 0, 0.11);
padding: 4px;
border-radius: 12px;
}
.dark .item:active {
background-color: rgba(255, 255, 255, 0.158);
}
.item_title {
color: rgba(0, 0, 0, 0.897);
margin-bottom: 2px;
text-align: center;
font-size: 12px;
}
.item_measure {
color: #ffffff;
font-size: 12px;
}
.item_attempt {
color: rgba(255, 255, 255, 0.589);
text-align: center;
font-size: 12px;
}
.dark .item_title {
color: rgba(0, 0, 0, 0.904);
}
.attempt {
width: 40px;
height: 40px;
font-size: 24px;
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.05);
justify-content: center;
align-items: center;
}
.pass {
background-color: rgb(165, 214, 29);
}
.fail {
background-color: rgb(230, 69, 101);
}
.dark .attempt {
background-color: rgba(255, 255, 255, 0.096);
}
.dark .pass {
background-color: rgb(134, 173, 83);
}
.dark .fail {
background-color: rgb(214, 73, 101);
}
</style>
<script>
import device from "@system.device";
import share from '@system.share';
module.exports = {
props: ["gridContent", "gridContentNumber", "gridProfile", "gridIndex", "position"],
data: {
darkMode: "",
altImage:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAeKADAAQAAAABAAAAeAAAAAAI4lXuAAAD40lEQVR4Ae2ci3KbMBBF3df0/3+3TdrqDpHrJAZLWCt2l6MZBQcMks7RYhCPy4UEAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAIH0BL5MbqHK+/qW9Xl2+ZObey3ub/mk/Oct6/OUNBPw99IiZdLl8lIgKJunb+YlLAX8KBPk/oetvZiCSxFtmmYIJnLvK5RkJVPJtZClqPF/1UuJ3HWuYmP6M2kt2Hr76+jiLDFlZLpx694Zx+FmTUNHsGnlN7HFWWjKyDqC42BOWlMEJxVbm4XgSiLpFMFJxdZmIbiSSDr1PgihUZ7Xkm9HezT65r3ebrqLZ1BrA/KaL+mq+4yhVjey9lTE6y56TW5toy63/S75NrLrMqY3BDwKlrTWS2mSTNog4FGwdr+tSZHc8/3W7ab5nkfBvbvdaXdHRLTuUXAvRwRvEMsg2HSwfoNdiEUeBfee+nhsgxv5HuHo/LY1KtUZPLYBwQ8ItAzAqBPoZj7SBoEWkBurmy1SZEqgznPvHURpOXILhEfJq2DVW7venyXrPFeSlSVd89ktFwgtybPgWv/eg666HtNCgEhI3g0QjODkBJI3jwhGcHICyZtHBCcXHOE0aZYCnWfrUmUdWFHnDx8ACF66jwZTdBdJlbvMXQZWNGIWVnTYilcDA6YaDl0bEpXwXyW33kI0oDpjN3F2wRLbcsvPo5sAx1oZuLUzC26VW3GHlHxWwb1yw0o+o+C9ck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J1vqaeP/UGMyZcTpc6XirP/4qeuY8EweTIQABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCDQGoF/QkXhCrj0cVkAAAAASUVORK5CYII="
},
onInit: function () {
this.darkMode = device.getThemeSync().darkMode ? "dark" : "";
},
shareResult(attempt, name, measure, position) {
share.share({
type:"text/html",
data:`Hey, what a competition!\n${name}'s just jumped: ${measure}\nCurrent position: ${position}`,
success: function(data) {
console.log("Success sharing");
},
fail: function(data, code) {
console.log("Sharing failed, code=" + code);
}
});
}
};
</script>
\ No newline at end of file
<template>
<div class="header" onresize="resize">
<stack style="width: {{imageWidth}}px;height:{{imageHeight}}px;">
<image class="header_background" oncomplete="loadImageSuccess" style="width: {{imageWidth}}px;height:{{imageHeight}}px;" src="{{titleContent.backgroundImage}}"></image>
<div if="{{!loadImageStatus}}" class="alt_box" style="width: {{imageWidth}}px;height:{{imageHeight}}px;">
<image class="alt_image" src="{{darkMode==='dark'?altImage_dark:altImage}}"></image>
</div>
<div class="header_box">
<div class="header_action">
<image class="header_title_img" src="{{logoUrl}}"></image>
<text class="header_title">{{ titleContent.title }}</text>
</div>
</div>
<div class="header_description">
<text class="location">{{ titleContent.location }}</text>
<text class="stage">{{ titleContent.stage }}</text>
</div>
</stack>
</div>
</template>
<style lang="sass">
.header {
flex-direction: column;
justify-content: space-between;
width: 100%;
margin-bottom: 8px;
}
.header_box {
height: 36px;
width: 230px;
margin-left: 12px;
}
.header_caption {
font-size: 12px;
}
.header_action {
height: 32px;
margin-top: 2px;
border-radius: 12px;
align-items: center;
}
.header_title_img {
width: 16px;
height: 16px;
margin-right: 4px;
}
.header_title {
lines: 1;
text-overflow: ellipsis;
color: rgb(255, 255, 255);
font-size: 12px;
font-weight: bold;
}
.header_description {
position: absolute;
flex-direction: column;
left: 12px;
right: 12px;
bottom: 0px;
justify-content: center;
}
.location {
color: rgba(255, 255, 255, 0.589);
opacity: 0.6;
margin-bottom: 2px;
font-size: 12px;
}
.stage {
color: rgb(255, 255, 255);
lines: 2;
text-overflow: ellipsis;
margin-bottom: 4px;
font-size: 16px;
}
.alt_box {
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.05);
justify-content: center;
align-items: center;
}
.dark .alt_box {
background-color: rgba(255, 255, 255, 0.1);
}
.alt_image {
width: 84px;
height: 84px;
}
</style>
<script>
import device from "@system.device";
module.exports = {
props: ["titleContent"],
data: {
titleContent: {
title: "",
backgroundImage: "",
location: "",
stage: ""
},
logoUrl: "https://espinr.github.io/sandbox/quickapps/euro-champs-widget/images/logo.png",
screenDensity: 3,
resolution: 1080,
imageWidth: 0,
imageHeight: 0,
loadImageStatus:false,
darkMode: "",
altImage:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAeKADAAQAAAABAAAAeAAAAAAI4lXuAAAD40lEQVR4Ae2ci3KbMBBF3df0/3+3TdrqDpHrJAZLWCt2l6MZBQcMks7RYhCPy4UEAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAIH0BL5MbqHK+/qW9Xl2+ZObey3ub/mk/Oct6/OUNBPw99IiZdLl8lIgKJunb+YlLAX8KBPk/oetvZiCSxFtmmYIJnLvK5RkJVPJtZClqPF/1UuJ3HWuYmP6M2kt2Hr76+jiLDFlZLpx694Zx+FmTUNHsGnlN7HFWWjKyDqC42BOWlMEJxVbm4XgSiLpFMFJxdZmIbiSSDr1PgihUZ7Xkm9HezT65r3ebrqLZ1BrA/KaL+mq+4yhVjey9lTE6y56TW5toy63/S75NrLrMqY3BDwKlrTWS2mSTNog4FGwdr+tSZHc8/3W7ab5nkfBvbvdaXdHRLTuUXAvRwRvEMsg2HSwfoNdiEUeBfee+nh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mDkjohLHeVdcCtyN3v8xbPgVuRqZ0PwoMppRq499iK5m73Ly+Me3IzcbqPd9K/9vAluSq7tvXpD0KZvCfL0dGEzcj09dupFsB661tvthvFsdnLSVa/Dr5R4NI+bmnEIdFigtb9Tb5MJiBsoawu9cPlURguz/T97aahL395+UyGCL1SUEYK33zriCrY+Sap+Qj4ZX8n7xXtBcq+39B58Z5L1+oPNu7LmBpchv7eOTYasprNIOSucXnrBFDtDDvsikwXFTJ1Ve27y3welZjo2XzXBWrlJ1vqaeP/UGMyZcTpc6XirP/4qeuY8EweTIQABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCDQGoF/QkXhCrj0cVkAAAAASUVORK5CYII="
},
onInit: function () {
try {
var mediaquery = require("@system.mediaquery");
if (mediaquery) {
var media = mediaquery.matchMedia("screen and (orientation: landscape)");
media.addListener(() => {
this.resize();
});
}
} catch (error) {
this.imageWidth = 750;
this.imageHeight = Math.ceil((this.imageWidth / 5) * 2);
}
this.darkMode = device.getThemeSync().darkMode ? "dark" : "";
},
resize() {
let deviceInfo = device.getInfoSync();
this.imageWidth = deviceInfo.windowLogicWidth;
this.imageHeight = Math.ceil((this.imageWidth / 5) * 2);
},
dpConvert: function (dpValue) {
return dpValue * (750 / (this.resolution / this.screenDensity));
},
emitEvent() {
console.log("click event");
},
loadImageSuccess(){
this.loadImageStatus=true;
}
};
</script>
\ No newline at end of file
<import name="header" src="./common/component/header/header.ux"></import>
<import name="grid" src="./common/component/grid/grid.ux"></import>
<import name="footer" src="./common/component/footer/footer.ux"></import>
<template>
<div class="grid_box {{layoutDirection}} {{darkMode}}" designWidth="device-width">
<header title-content="{{titleContent}}"></header>
<block for="{{athletes.slice(0,Number(numberAthletes))}}">
<grid position={{$item.position}} grid-index="{{$idx}}" grid-content="{{ $item.attemptsArray }}" grid-content-number="{{ $item.numberAttempts }}" grid-profile="{{ $item.profile }}"></grid>
</block>
<footer button-array="{{buttonArray}}"></footer>
</div>
</template>
<style lang="sass">
.grid_box {
flex-direction: column;
}
.dark {
background-color: #000000;
color: #ffffff;
}
</style>
<script>
import device from "@system.device";
import message from "@card.message";
import configuration from "@system.configuration";
import { athletes } from "./data";
module.exports = {
data: {
titleContent: {
title: "Zadar EAP Meeting",
titleDeepLink: 'null',
logoUrl: 'https://espinr.github.io/sandbox/quickapps/euro-champs-widget/images/logo.png',
backgroundImage: 'https://espinr.github.io/sandbox/quickapps/euro-champs-widget/images/longjump_bw.jpg',
location: "Zadar (HVR), Sep 22",
stage: "Long Jump - Final (8 Athletes)"
},
numberAthletes: 8,
athletes: athletes,
buttonArray: ["NOTIFICATIONS", "OTHER", "MORE..."],
layoutDirection: "ltr",
darkMode: ""
},
onInit: function () {
message.sendMessage({ parameters: { background: "dark" }, eventID: "Display" });
this.layoutDirection = configuration.getLayoutDirection();
this.darkMode = device.getThemeSync().darkMode ? "dark" : "";
}
};
</script>
\ No newline at end of file
export const athletes = [
{
profile: {
name: "DOE, Elizabeth", bib: "120", country: "za"
},
position: 1,
attemptsArray: [
{
attempt: "1",
measure: "6.34"
},
{
attempt: "2",
measure: "X"
},
{
attempt: "3",
measure: "X"
},
{
attempt: "4",
measure: "6.45"
},
{
attempt: "5",
measure: "6.22"
},
{
attempt: "6",
measure: ""
}
],
numberAttempts: "6",
},
{
profile: {
name: "JONES, Sarah", bib: "283", country: "at"
},
position: 2,
attemptsArray: [
{
attempt: "1",
measure: "X"
},
{
attempt: "2",
measure: "5.67"
},
{
attempt: "3",
measure: "X"
},
{
attempt: "4",
measure: "6.17"
},
{
attempt: "5",
measure: "5.98"
},
{
attempt: "6",
measure: ""
},
],
numberAttempts: "6",
},
{
profile: {
name: "WILLIAMS, Mary", bib: "837", country: "au"
},
position: 2,
attemptsArray: [
{
attempt: "1",
measure: "5.98"
},
{
attempt: "2",
measure: "6.17"
},
{
attempt: "3",