Skip to content

Commit

Permalink
Merge pull request #2 from fleetbase/dev-v0.2.5
Browse files Browse the repository at this point in the history
v0.2.5
  • Loading branch information
roncodes authored Dec 25, 2023
2 parents 2abad5e + 3bede2e commit 952d176
Show file tree
Hide file tree
Showing 59 changed files with 4,679 additions and 3,687 deletions.
12 changes: 2 additions & 10 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
16 changes: 4 additions & 12 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# server
/server/
/server_vendor/
22 changes: 9 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
requireConfigFile: false,
babelOptions: {
plugins: [['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }]],
},
},
plugins: ['ember'],
Expand All @@ -28,10 +29,10 @@ module.exports = {
'ember/classic-decorator-no-classic-methods': 'off',
'ember/no-shadow-route-definition': 'off',
'no-prototype-builtins': 'off',
'node/no-unpublished-require': [
'n/no-unpublished-require': [
'error',
{
allowModules: ['resolve', 'broccoli-funnel'],
allowModules: ['resolve', 'broccoli-funnel', 'broccoli-merge-trees'],
},
],
},
Expand All @@ -41,6 +42,7 @@ module.exports = {
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
Expand All @@ -56,13 +58,7 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
extends: ['plugin:n/recommended'],
},
],
};
10 changes: 5 additions & 5 deletions .github/workflows/ember.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [16.x] # Build on Node.js 16
node-version: [18.x] # Build on Node.js 18

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -42,10 +42,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Node.js 16.x
- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Setup pnpm
uses: pnpm/[email protected]
Expand All @@ -71,10 +71,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Node.js 16.x
- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Setup pnpm
uses: pnpm/[email protected]
Expand Down
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/
/declarations/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
9 changes: 2 additions & 7 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
Expand All @@ -18,11 +14,11 @@
/.gitignore
/.prettierignore
/.prettierrc.js
/.stylelintignore
/.stylelintrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
Expand All @@ -33,7 +29,6 @@

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
14 changes: 1 addition & 13 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/
.*/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
printWidth: 190,
overrides: [
{
files: '*.hbs',
files: '*.{hbs,js,ts}',
options: {
singleQuote: false,
},
Expand Down
12 changes: 12 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/

# server
/server/
/server_vendor/
5 changes: 5 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
rules: {
'no-invalid-interactive': 'off',
'no-yield-only': 'off',
'no-down-event-binding': 'off',
'no-pointer-down-event-binding': 'off',
'table-groups': 'off',
'link-href-attributes': 'off',
'require-input-label': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": ["dist"]
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ This monorepo contains both the frontend and backend components of the Storefron

### Requirements

- PHP 7.3.0 or above
- Ember.js v3.24 or above
- Ember CLI v3.24 or above
- Node.js v14 or above
* PHP 7.3.0 or above
* Ember.js v4.8 or above
* Ember CLI v4.8 or above
* Node.js v18 or above

## Structure

Expand Down
2 changes: 1 addition & 1 deletion addon/components/modals/import-products.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{#if @options.isProcessing}}
<div class="min-h-56 dropzone w-full rounded px-4 py-8 min-h 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">
<PageLoader class="text-sm dar:text-gray-100" @loadingMessage="Processing import..." />
<Spinner class="text-sm dark:text-gray-100" @loadingMessage="Processing import..." />
</div>
</div>
{{else}}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/schedule-manager.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
{{#each-in this.schedule as |day hours|}}
<div class="content-panel {{@contentPanelClass}} shadow-sm">
<div class="content-panel-header items-center {{@contentPanelHeaderClass}}">
<h4 class="font-semibold dark:text-gray-100">{{day}}</h4>
<h4 class="font-semibold text-sm dark:text-gray-100">{{day}}</h4>
<div>
<Button @icon="calendar-week" @text="Add Hours" @onClick={{fn this.addHours @subject day}} class="{{@addHoursButtonClass}}" />
<Button @icon="calendar-week" @text="Add Hours" @textClass="truncate text-xs" @size="sm" @onClick={{fn this.addHours @subject day}} class="{{@addHoursButtonClass}}" />
</div>
</div>
<div class="content-panel-body {{@contentPanelBodyClass}}">
Expand Down
2 changes: 1 addition & 1 deletion addon/components/widget/customers.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ContentPanel @title={{this.title}} @titleStatusRight={{this.customers.length}} @titleStatuRightClass="info-status-badge" @hideStatusDot={{true}} @open={{this.customers.length}} @pad={{false}} @wrapperClass={{@wrapperClass}} @onInsert={{this.getCustomers}}>
<ContentPanel @title={{this.title}} @titleStatusRight={{this.customers.length}} @titleStatusRightClass="info-status-badge" @hideStatusDot={{true}} @open={{this.customers.length}} @pad={{false}} @wrapperClass={{@wrapperClass}} @onInsert={{this.getCustomers}}>
{{#if this.isLoading}}
<div class="px-3 py-2">
<Spinner class="text-sky-400" />
Expand Down
11 changes: 7 additions & 4 deletions addon/components/widget/customers.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action, computed } from '@ember/object';
import { action } from '@ember/object';
import setComponentArg from '@fleetbase/ember-core/utils/set-component-arg';

export default class WidgetCustomersComponent extends Component {
@service store;
@service storefront;
@tracked isLoading = true;
@tracked customers = [];
@tracked title = 'Recent Customers';

@computed('args.title') get title() {
return this.args.title || 'Recent Customers';
constructor(owner, { title }) {
super(...arguments);
setComponentArg(this, 'title', title);
}

@action async getCustomers() {
Expand All @@ -28,7 +31,7 @@ export default class WidgetCustomersComponent extends Component {
this.isLoading = true;

return new Promise((resolve) => {
const storefront = this.storefront?.activeStore?.public_id;
const storefront = this.storefront.getActiveStore('public_id');

if (!storefront) {
this.isLoading = false;
Expand Down
4 changes: 4 additions & 0 deletions addon/components/widget/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export default class WidgetOrdersComponent extends Component {
return this.args.title ?? 'Recent Orders';
}

constructor() {
super(...arguments);
}

@action async setupWidget() {
later(
this,
Expand Down
31 changes: 31 additions & 0 deletions addon/controllers/base-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default class BaseController extends Controller {
/**
* Inject the `universe` service
*
* @var {Service}
*/
@service universe;

/**
* Transitions to a specified route within the '@fleetbase/storefront-engine' engine.
*
* This action is a wrapper around the `transitionToEngineRoute` method of the `universe` service (or object),
* specifically targeting the '@fleetbase/storefront-engine'. It allows for easy transitioning to routes
* within this engine, abstracting away the need to repeatedly specify the engine name.
*
* @param {string} route - The route within the '@fleetbase/storefront-engine' to transition to.
* @param {...any} args - Additional arguments to pass to the transitionToEngineRoute method.
* @returns {Promise} A Promise that resolves with the result of the transitionToEngineRoute method.
*
* @example
* // To transition to the 'management.fleets.index.new' route within the '@fleetbase/storefront-engine'
* this.transitionToRoute('management.fleets.index.new');
*/
@action transitionToRoute(route, ...args) {
return this.universe.transitionToEngineRoute('@fleetbase/storefront-engine', route, ...args);
}
}
Loading

0 comments on commit 952d176

Please sign in to comment.