More work on enhanced apps

This commit is contained in:
Kode
2022-03-15 20:09:22 +00:00
parent 1e35f83fed
commit ed3dbf2f14
8 changed files with 89 additions and 9 deletions

View File

@@ -161,12 +161,13 @@ class Item extends Model
public function enhanced()
{
if(isset($this->class) && !empty($this->class)) {
/*if(isset($this->class) && !empty($this->class)) {
$app = new $this->class;
} else {
return false;
}
return (bool)($app instanceof \App\EnhancedApps);
return (bool)($app instanceof \App\EnhancedApps);*/
return $this->description !== null;
}
public static function isEnhanced($class)
@@ -195,12 +196,12 @@ class Item extends Model
public function getconfig()
{
$explode = explode('\\', $this->class);
// $explode = explode('\\', $this->class);
if(!isset($this->description) || empty($this->description)) {
$config = new \stdClass;
$config->name = end($explode);
// $config->name = end($explode);
$config->enabled = false;
$config->override_url = null;
$config->apikey = null;
@@ -211,7 +212,7 @@ class Item extends Model
$config = json_decode($this->description);
$config->name = end($explode);
// $config->name = end($explode);
$config->url = $this->url;

36
public/css/app.css vendored
View File

@@ -441,7 +441,39 @@ body {
.item-container .tooltip.active {
transform: translateY(0);
opacity: 1;
z-index: 2;
z-index: 4;
}
.tile-actions {
position: absolute;
top: 0px;
left: 0;
padding: 7px;
background: #000000d9;
font-size: 12px;
line-height: 1;
border-radius: 6px;
width: 80px;
height: 90px;
display: flex;
opacity: 0;
align-items: center;
justify-content: center;
transition: all 0.3s;
flex-direction: column;
text-align: center;
cursor: pointer;
}
.tile-actions.active {
opacity: 1;
}
.refresh {
z-index: 3;
}
.refresh .icon {
font-size: 20px;
margin-bottom: 5px;
}
.black {
@@ -918,6 +950,8 @@ a.settinglink {
position: relative;
width: 100%;
max-width: 620px;
position: relative;
z-index: 4;
}
.searchform form {
width: 100%;

2
public/js/app.js vendored
View File

@@ -643,8 +643,10 @@ $.when($.ready).then(function () {
$('#sortable').sortable('disable');
$('#sortable').on('mouseenter', '.item', function () {
$(this).siblings('.tooltip').addClass('active');
$('.refresh', this).addClass('active');
}).on('mouseleave', '.item', function () {
$(this).siblings('.tooltip').removeClass('active');
$('.refresh', this).removeClass('active');
});
$('#search-container').on('input', 'input[name=q]', function () {
var search = this.value;

View File

@@ -480,6 +480,7 @@ function define(prefix, icons) {
/* fas icons */
var icons = {
"arrow-alt-to-right": [448, 512, [], "f34c", "M448 88v336c0 13.3-10.7 24-24 24h-24c-13.3 0-24-10.7-24-24V88c0-13.3 10.7-24 24-24h24c13.3 0 24 10.7 24 24zM24 320h136v87.7c0 17.8 21.5 26.7 34.1 14.1l152.2-152.2c7.5-7.5 7.5-19.8 0-27.3L194.1 90.1c-12.6-12.6-34.1-3.7-34.1 14.1V192H24c-13.3 0-24 10.7-24 24v80c0 13.3 10.7 24 24 24z"],
"arrow-rotate-right": [512, 512, [8635, "arrow-right-rotate", "arrow-rotate-forward", "redo"], "f01e", "M496 48V192c0 17.69-14.31 32-32 32H320c-17.69 0-32-14.31-32-32s14.31-32 32-32h63.39c-29.97-39.7-77.25-63.78-127.6-63.78C167.7 96.22 96 167.9 96 256s71.69 159.8 159.8 159.8c34.88 0 68.03-11.03 95.88-31.94c14.22-10.53 34.22-7.75 44.81 6.375c10.59 14.16 7.75 34.22-6.375 44.81c-39.03 29.28-85.36 44.86-134.2 44.86C132.5 479.9 32 379.4 32 256s100.5-223.9 223.9-223.9c69.15 0 134 32.47 176.1 86.12V48c0-17.69 14.31-32 32-32S496 30.31 496 48z"],
"ban": [512, 512, [], "f05e", "M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"],
"check": [512, 512, [], "f00c", "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"],
"cloud-download": [640, 512, [], "f0ed", "M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zm-139.9 93L305 412.3c-9.4 9.4-24.6 9.4-33.9 0l-92.7-92.7c-9.4-9.4-9.4-24.6 0-33.9l10.8-10.8c9.6-9.6 25.2-9.3 34.5.5l32.4 34.5V184c0-13.3 10.7-24 24-24h16c13.3 0 24 10.7 24 24v125.9l32.4-34.5c9.3-9.9 24.9-10.1 34.5-.5l10.8 10.8c9.2 9.3 9.2 24.5-.1 33.9z"],

View File

@@ -1,4 +1,4 @@
{
"/css/app.css": "/css/app.css?id=af5899107a5ec84f0b3a",
"/js/app.js": "/js/app.js?id=39f89cbf3b7659f70528"
"/css/app.css": "/css/app.css?id=ed6bea8358b8d66efbb8",
"/js/app.js": "/js/app.js?id=ff749484877e4ce6c2f6"
}

View File

@@ -130,8 +130,10 @@ $.when( $.ready ).then(function() {
$('#sortable').on('mouseenter', '.item', function () {
$(this).siblings('.tooltip').addClass('active')
$('.refresh', this).addClass('active')
}).on('mouseleave', '.item', function () {
$(this).siblings('.tooltip').removeClass('active')
$('.refresh', this).removeClass('active')
})
$('#search-container').on('input', 'input[name=q]', function () {

View File

@@ -221,10 +221,40 @@ body {
&.active {
transform: translateY(0);
opacity: 1;
z-index: 2;
z-index: 4;
}
}
}
.tile-actions {
position: absolute;
top: 0px;
left: 0;
padding: 7px;
background: #000000d9;
font-size: 12px;
line-height: 1;
border-radius: 6px;
width: 80px;
height: 90px;
display: flex;
opacity: 0;
align-items: center;
justify-content: center;
transition: all 0.3s;
flex-direction: column;
text-align: center;
cursor: pointer;
&.active {
opacity: 1;
}
}
.refresh {
z-index: 3;
.icon {
font-size: 20px;
margin-bottom: 5px;
}
}
.black {
color: #000!important;
}
@@ -717,6 +747,8 @@ div.create {
position: relative;
width: 100%;
max-width: 620px;
position: relative;
z-index: 4;
form {
width: 100%;
}

View File

@@ -12,6 +12,14 @@
@endif
</div>
<a rel="noopener noreferrer" title="{{ App\Item::getApplicationDescription($app->class) }}" class="link{{ title_color($app->colour) }}"{!! $app->link_target !!} href="{{ $app->link }}"><i class="fas {{ $app->link_icon }}"></i></a>
@if($app->enhanced() === true)
<div class="tile-actions refresh">
<div class="icon">
<i class="fas fa-arrow-rotate-right"></i>
</div>
Refresh Stats
</div>
@endif
</div>
<a class="item-edit" href="{{ route($app->link_type.'.edit', [ $app->id ]) }}"><i class="fas fa-pencil"></i></a>
@if(App\Item::getApplicationDescription($app->class) !== '')<div class="tooltip">{{ App\Item::getApplicationDescription($app->class) }}</div>@endif