]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5468 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Dec 2022 09:02:37 +0000 (10:02 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Dec 2022 09:02:37 +0000 (10:02 +0100)
app/Models/Traits/FluidbookPlayerBranches.php
app/SubForms/Link/Base.php
app/Util/FluidbookFarm.php
resources/linkeditor/style/form.sass
resources/linkeditor/style/panels.sass
resources/linkeditor/style/variables.sass

index 5ae5484ea96f534095301019a5ee8fe7344f4bbf..b060513c31dd6ff7698794b00332cd3a88a569f4 100644 (file)
@@ -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;
     }
 }
index b605273213bedc3c217a65be42060744ddac8e55..71d4583e9df871fca78ada17902119d1bd44c0ea 100644 (file)
@@ -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);
index 8be3da4793ce2fe283b8ac264a6c1571e1b65ac3..ebfd5d4b4c62b49f08e795b305f0a4201264fc09 100644 (file)
@@ -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;
             }
         }
index 5b9c8cd2a8045490243489bff082173b7c53beeb..507dc2be37e23a1f600d44d5c0a2cb01c9a6bd7c 100644 (file)
         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
         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
 
     #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
         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%
index f459fd531dc6cc7b262fa0cad3f5afd082299b13..fb87cb597aa67940b23646492fcdf802a08f3e4a 100644 (file)
@@ -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
index cfaf64cb348f81b1c598cda7305ff3b4bfb61b49..2b1e58b70e7096363b34f1c30fc132f85fe6c5ac 100644 (file)
@@ -9,4 +9,4 @@ $toolbar-height: 40px
 $toolbar-color: #5d5d5d
 $toolbar-color-dark: #bbb
 
-$panel-background: #fcfcfc
+$panel-background: #dcdcdc