Skip to content

Commit

Permalink
Merge pull request #8 from fleetbase/dev-v0.2.9
Browse files Browse the repository at this point in the history
v0.2.9
  • Loading branch information
roncodes authored Feb 1, 2024
2 parents cd1bb7f + 84cfa6e commit c141dfe
Show file tree
Hide file tree
Showing 6 changed files with 834 additions and 974 deletions.
9 changes: 7 additions & 2 deletions addon/controllers/products/index/category/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ export default class ProductsIndexCategoryNewController extends BaseController {
return;
}

// Queue and upload immediatley
this.uploadQueue.pushObject(file);
this.fetch.uploadFile.perform(
file,
{
path: `uploads/storefront/${this.activeStore.id}/products`,
subject_uuid: this.product.id,
subject_type: `storefront:product`,
type: `storefront_product`,
subject_type: 'storefront:product',
type: 'storefront_product',
},
(uploadedFile) => {
this.product.files.pushObject(uploadedFile);
Expand All @@ -116,6 +117,10 @@ export default class ProductsIndexCategoryNewController extends BaseController {
},
() => {
this.uploadQueue.removeObject(file);
// remove file from queue
if (file.queue && typeof file.queue.remove === 'function') {
file.queue.remove(file);
}
}
);
}
Expand Down
25 changes: 12 additions & 13 deletions addon/templates/products/index/category/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -214,36 +214,35 @@
class="min-h-56 dropzone w-full rounded-lg px-4 py-8 min-h bg-gray-50 dark:bg-gray-900 bg-opacity-25 text-gray-900 dark:text-white text-center flex flex-col items-center justify-center border-2 border-dashed border-gray-200 dark:border-indigo-500"
>
<div class="flex items-center justify-center py-5">
<Spinner class="text-sm dar:text-gray-100" @loadingMessage="Uploading..." />
<Spinner class="text-sm dar:text-gray-100" @loadingMessage={{t "component.dropzone.uploading"}} />
</div>
</div>
{{else}}
{{#let (file-queue name="files" onFileAdded=this.queueFile accept=(join "," this.acceptedFileTypes)) as |queue|}}
<FileDropzone @queue={{queue}} class="dropzone file-dropzone" as |dropzone|>
{{#if dropzone.active}}
{{#if dropzone.valid}}
Drop to upload
{{t "component.dropzone.drop-to-upload"}}
{{else}}
Invalid
{{t "component.dropzone.invalid"}}
{{/if}}
{{else if queue.files.length}}
<div class="my-2">
<FaIcon @icon="photo-video" class="text-indigo-500 mr-2" />
{{pluralize queue.files.length "file"}}
ready for upload.
{{t "component.dropzone.files-ready-for-upload" numOfFiles=(pluralize queue.files.length (t "component.dropzone.file"))}}
</div>
<div class="my-2">({{queue.progress}}%)</div>
{{else}}
<h4 class="font-semibold mb-8">
<FaIcon @icon="photo-video" @size="2x" class="text-indigo-500 mr-2" />
Upload Images & Videos
{{t "component.dropzone.upload-images-videos"}}
</h4>
<div>
{{#if dropzone.supported}}
<p class="text-base font-semibold my-5">Drag and drop image and video files onto this dropzone</p>
<p class="text-base font-semibold my-5">{{t "component.dropzone.dropzone-supported-images-videos"}}</p>
{{/if}}
<FileUpload @name="files" @for="files" @accept={{join "," this.acceptedFileTypes}} @multiple={{true}} @onFileAdded={{this.queueFile}}>
<a tabindex={{0}} class="btn btn-magic cursor-pointer ml-1">or select files to upload.</a>
<a tabindex={{0}} class="btn btn-magic cursor-pointer ml-1">{{t "component.dropzone.or-select-button-text"}}</a>
</FileUpload>
</div>
{{/if}}
Expand All @@ -252,15 +251,15 @@
{{#if this.uploadQueue}}
<div class="mx-4">
<div class="flex items-center justify-between mb-4">
<span class="leading-6 dark:text-gray-100">Upload Queue</span>
<span class="leading-6 dark:text-gray-100">{{t "component.dropzone.upload-queue"}}</span>
</div>
<div class="space-y-2 mb-4">
{{#each this.uploadQueue as |file|}}
<div class="flex items-center justify-between bg-green-100 border border-green-800 dark:border-green-800 py-1.5 shadow-sm rounded-lg px-4">
<div class="text-sm text-green-900">{{file.name}}</div>
<div class="flex items-center justify-between bg-blue-100 border border-blue-800 dark:border-blue-800 py-1.5 shadow-sm rounded-lg px-4">
<div class="text-xs text-blue-900 truncate">{{truncate-filename file.name 50}}</div>
<div class="flex items-center text-sm">
<Spinner class="text-green-900 mr-2" />
<span class="font-bold text-green-900">{{round file.progress}}%</span>
<Spinner class="text-blue-900 mr-2" />
<span class="font-bold text-blue-900">{{round file.progress}}%</span>
</div>
</div>
{{/each}}
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fleetbase/storefront-api",
"version": "0.2.8",
"version": "0.2.9",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"keywords": [
"fleetbase-extension",
Expand All @@ -22,8 +22,8 @@
],
"require": {
"php": "^7.4|^8.0",
"fleetbase/core-api": "^1.3.12",
"fleetbase/fleetops-api": "^0.4.1",
"fleetbase/core-api": "^1.3.13",
"fleetbase/fleetops-api": "^0.4.4",
"geocoder-php/google-maps-places-provider": "^1.4",
"laravel-notification-channels/apn": "^3.8",
"laravel-notification-channels/fcm": "^2.7",
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Storefront",
"version": "0.2.8",
"version": "0.2.9",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"repository": "https://github.com/fleetbase/storefront",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/storefront-engine",
"version": "0.2.8",
"version": "0.2.9",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"fleetbase": {
"route": "storefront",
Expand Down Expand Up @@ -44,8 +44,8 @@
},
"dependencies": {
"@fleetbase/ember-core": "^0.2.0",
"@fleetbase/ember-ui": "^0.2.9",
"@fleetbase/fleetops-data": "^0.1.7",
"@fleetbase/ember-ui": "^0.2.10",
"@fleetbase/fleetops-data": "^0.1.8",
"@babel/core": "^7.23.2",
"@fortawesome/ember-fontawesome": "^0.4.1",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
Expand Down
Loading

0 comments on commit c141dfe

Please sign in to comment.