From 4bb5ba38006c4437bc8f2a2c447fa6ceff290e48 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 1 Dec 2022 10:02:37 +0100 Subject: [PATCH] wip #5468 @1 --- app/Models/Traits/FluidbookPlayerBranches.php | 14 +- app/SubForms/Link/Base.php | 8 +- app/Util/FluidbookFarm.php | 2 +- resources/linkeditor/style/form.sass | 127 ++++++++++++++---- resources/linkeditor/style/panels.sass | 4 +- resources/linkeditor/style/variables.sass | 2 +- 6 files changed, 122 insertions(+), 35 deletions(-) diff --git a/app/Models/Traits/FluidbookPlayerBranches.php b/app/Models/Traits/FluidbookPlayerBranches.php index 5ae5484ea..b060513c3 100644 --- a/app/Models/Traits/FluidbookPlayerBranches.php +++ b/app/Models/Traits/FluidbookPlayerBranches.php @@ -37,10 +37,17 @@ trait FluidbookPlayerBranches return Files::mkdir(resource_path('fluidbookpublication/player')); } + /** + * @return array + */ protected function getActiveBranches() { $cacheFile = self::getFluidbookPlayerBaseDirectory() . 'activebranches'; - return json_decode(file_get_contents($cacheFile)); + $res = json_decode(file_get_contents($cacheFile), true); + if (!$res) { + return self::updateAllBranches(); + } + return $res; } protected static function reposDirectory() @@ -80,6 +87,9 @@ trait FluidbookPlayerBranches return !in_array($branch, $this->getActiveBranches()); } + /** + * @return [] + */ protected function updateAllBranches() { PHP::neverStop(); @@ -108,5 +118,7 @@ trait FluidbookPlayerBranches } $this->executeGitCommands($branchesDir . $b, ['reset --hard origin/' . $b, 'pull']); } + + return $branches; } } diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index b60527321..71d4583e9 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -259,12 +259,12 @@ class Base extends Form $this->addField('header_disposition', FormSection::class, __('Disposition')); $this->addField('group_disposition', FieldGroupStart::class); $this->addField('group_position', FieldGroupStart::class, __('Position')); - $this->addField('x', Text::class, 'X'); - $this->addField('y', Text::class, 'Y'); + $this->addField('x', Text::class, 'X',['suffix'=>'px']); + $this->addField('y', Text::class, 'Y',['suffix'=>'px']); $this->addField('group_position_end', FieldGroupEnd::class); $this->addField('group_dimensions', FieldGroupStart::class, __('Dimensions')); - $this->addField('w', Text::class, 'W'); - $this->addField('h', Text::class, 'H'); + $this->addField('w', Text::class, 'W',['suffix'=>'px']); + $this->addField('h', Text::class, 'H',['suffix'=>'px']); $this->addField('group_dimensions_end', FieldGroupEnd::class); if ($this->_displayedOnFluidbook) { $this->addField('group_transform', FieldGroupStart::class); diff --git a/app/Util/FluidbookFarm.php b/app/Util/FluidbookFarm.php index 8be3da479..ebfd5d4b4 100644 --- a/app/Util/FluidbookFarm.php +++ b/app/Util/FluidbookFarm.php @@ -109,7 +109,7 @@ class FluidbookFarm $pings = []; if (file_exists($cache)) { $cached = json_decode(file_get_contents($cache)); - if (count($cached) === count($servers)) { + if (is_countable($cached) && count($cached) === count($servers)) { $pings = $cached; } } diff --git a/resources/linkeditor/style/form.sass b/resources/linkeditor/style/form.sass index 5b9c8cd2a..507dc2be3 100644 --- a/resources/linkeditor/style/form.sass +++ b/resources/linkeditor/style/form.sass @@ -16,49 +16,109 @@ vertical-align: top position: relative -.select2-container--bootstrap - font-size: 12px - font-weight: 500 - color: #5D5D5D - hr - border: 0 - height: 1px - background-color: #d5d5d5 - margin: 5px 0 +#linkeditor-panel-form + --form-text-color: #5d5d5d + --field-background: #fff + --field-color: #111 + --field-border: #aaa - &.select2-container--focus .select2-selection, &.select2-container--open .select2-selection - box-shadow: 0 0 8px rgba(0, 0, 0, 0.1) + @media (prefers-color-scheme: dark) + --form-text-color: #aaa + --field-background: #000 + --field-color: #ccc + --field-border: #777 -#linkeditor-panel-form padding: 12px - font-size: 12px + font-size: 13px + + .select2-container--bootstrap + font-size: 13px + font-weight: 400 + + hr + border: 0 + height: 1px + background-color: var(--form-text-color) + margin: 5px 0 + + &, .select2-selection + color: var(--form-text-color) + background-color: var(--field-background) + border-color: var(--field-background) + border-radius: 4px + box-shadow: none + + &.select2-container--focus .select2-selection, &.select2-container--open .select2-selection + box-shadow: 0 0 8px rgba(0, 0, 0, 0.1) + border-color: var(--field-border) h3 font-size: 16px - color: #5D5D5D + color: var(--form-text-color) text-transform: uppercase padding-top: 15px - border-top: 1px solid #5d5d5d + border-top: 1px solid var(--form-text-color) margin-top: 20px + p.help-block + color: var(--form-text-color) + font-size: 11px + padding-top: 2px + + .freefile-file + position: relative + &::after + content: "..." + position: absolute + display: block + padding: 6px + right: 0 + top: -3px + width: 34px + height: 34px + color: var(--field-color) + box-sizing: border-box + pointer-events: none + font-size: 17px + + input[type=file] + position: absolute + right: 0px + width: 35px + opacity: 0 + height: 100% + cursor: pointer + + .input-group + position: relative + .input-group-append + position: absolute + height: 100% + top: 0 + right: 0 + pointer-events: none + padding: 8px + textarea, input[type="text"], input[type="number"], input[type="email"], input[type="url"] font-family: $font height: 34px padding: 8px width: 100% - font-weight: 500 - color: #5D5D5D - border: 1px solid #D5D5D5 + font-weight: 400 + color: var(--field-color) + background-color: var(--field-background) + border: 1px solid var(--field-background) border-radius: 3px - font-size: 12px + font-size: 13px transition: box-shadow 500ms, border 500ms appearance: none &:focus - border: 1px solid #ccc - box-shadow: 0 0 8px rgba(0, 0, 0, 0.1) + border: 1px solid var(--field-border) + box-shadow: 0 0 8px rgba(0, 0, 0, 0.3) + textarea min-height: 150px @@ -66,15 +126,15 @@ min-width: 100% span - font-weight: 600 - font-size: 12px - color: #5D5D5D + font-weight: 400 + font-size: 13px + color: var(--form-text-color) label display: block font-weight: 600 font-size: 12px - color: #5D5D5D + color: var(--form-text-color) margin: 8px 0 5px 0 .checkbox @@ -92,10 +152,11 @@ #group_position, #group_dimensions, #group_transform margin-top: 5px + h4 font-size: 12px font-weight: 700 - color: #5D5D5D + color: var(--form-text-color) grid-column: 1 / 3 grid-row: 1 / 2 margin-bottom: 5px @@ -107,9 +168,23 @@ label display: inline-block width: 20px + input width: calc(100% - 20px) + [data-name="rot"] + label + display: block + .input-group + .input-group-append + right: 0 + + .input-group + display: inline-block + .input-group-append + right: 20px + + #group_transform input width: 100% diff --git a/resources/linkeditor/style/panels.sass b/resources/linkeditor/style/panels.sass index f459fd531..fb87cb597 100644 --- a/resources/linkeditor/style/panels.sass +++ b/resources/linkeditor/style/panels.sass @@ -4,7 +4,7 @@ position: relative @media (prefers-color-scheme: dark) - background-color: #333 + background-color: #444 nav position: absolute @@ -62,7 +62,7 @@ background: $panel-background height: 100% @media (prefers-color-scheme: dark) - background-color: #111 + background-color: #333 &.open display: block diff --git a/resources/linkeditor/style/variables.sass b/resources/linkeditor/style/variables.sass index cfaf64cb3..2b1e58b70 100644 --- a/resources/linkeditor/style/variables.sass +++ b/resources/linkeditor/style/variables.sass @@ -9,4 +9,4 @@ $toolbar-height: 40px $toolbar-color: #5d5d5d $toolbar-color-dark: #bbb -$panel-background: #fcfcfc +$panel-background: #dcdcdc -- 2.39.5