Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
janzenisaac committed Dec 18, 2023
1 parent 3240610 commit 220369a
Show file tree
Hide file tree
Showing 17 changed files with 202 additions and 234 deletions.
8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint-theme");
17 changes: 0 additions & 17 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
2 changes: 2 additions & 0 deletions .streerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
1 change: 1 addition & 0 deletions .template-lintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");
4 changes: 0 additions & 4 deletions .template-lintrc.js

This file was deleted.

133 changes: 65 additions & 68 deletions javascripts/discourse/components/kanban/card.gjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,75 @@
import Component from "@glimmer/component";
import i18n from "discourse-common/helpers/i18n";
import eq from "truth-helpers/helpers/eq";
import renderTag from "discourse/lib/render-tag";
import TopicStatus from "discourse/components/topic-status";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { htmlSafe } from "@ember/template";
import icon from "discourse-common/helpers/d-icon";
import PluginOutlet from "discourse/components/plugin-outlet";
import { hash } from "@ember/helper";
import { getOwner } from "@ember/application";
import concatClass from "discourse/helpers/concat-class";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { getOwner } from "@ember/application";
import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import TopicStatus from "discourse/components/topic-status";
import concatClass from "discourse/helpers/concat-class";
import { renderAvatar } from "discourse/helpers/user-avatar";
import renderTag from "discourse/lib/render-tag";
import icon from "discourse-common/helpers/d-icon";
import not from "truth-helpers/helpers/not";

export default class KanbanCard extends Component {
@service kanbanManager;

@tracked dragging;

// TODO - FIX THIS ONCE CORE EXPORTS IT PROPERLY
formatDate = getOwner(this).resolveRegistration("helper:format-date");
categoryBadge = getOwner(this).resolveRegistration("helper:category-badge");

@action
dragStart(event) {
this.dragging = true;
this.args.setDragData({ topic: this.args.topic });
event.dataTransfer.dropEffect = "move";
event.stopPropagation();
}

@action
dragEnd(event) {
this.dragging = false;
event.stopPropagation();
}

get showTags() {
return settings.show_tags && this.tags.length;
}

get cardStyle() {
return settings.card_style;
}

get tags() {
const definitionTags = this.args.definition.params.tags || [];
const discoveryTag = this.kanbanManager.discoveryTag?.id;
const listTags = [...definitionTags, discoveryTag];

return this.args.topic.tags
.reject((t) => listTags?.includes(t))
.map((t) => renderTag(t));
}

get showCategory() {
const definitionCategory = this.args.definition.params.category;
const discoveryCategory = this.kanbanManager.discoveryCategory;
return !(definitionCategory || discoveryCategory);
}

get showDetailed() {
return this.cardStyle === "detailed";
}

get lastPoster() {
return this.args.topic.posters.find((poster) =>
poster.extras?.includes("latest")
);
}
<template>
<a
class={{concatClass
Expand Down Expand Up @@ -131,60 +184,4 @@ export default class KanbanCard extends Component {
/>
</a>
</template>

@service kanbanManager;

@tracked dragging;

// TODO - FIX THIS ONCE CORE EXPORTS IT PROPERLY
formatDate = getOwner(this).resolveRegistration("helper:format-date");
categoryBadge = getOwner(this).resolveRegistration("helper:category-badge");

@action
dragStart(event) {
this.dragging = true;
this.args.setDragData({ topic: this.args.topic });
event.dataTransfer.dropEffect = "move";
event.stopPropagation();
}

@action
dragEnd(event) {
this.dragging = false;
event.stopPropagation();
}

get showTags() {
return settings.show_tags && this.tags.length;
}

get cardStyle() {
return settings.card_style;
}

get tags() {
const definitionTags = this.args.definition.params.tags || [];
const discoveryTag = this.kanbanManager.discoveryTag?.id;
const listTags = [...definitionTags, discoveryTag];

return this.args.topic.tags
.reject((t) => listTags?.includes(t))
.map((t) => renderTag(t));
}

get showCategory() {
const definitionCategory = this.args.definition.params.category;
const discoveryCategory = this.kanbanManager.discoveryCategory;
return !(definitionCategory || discoveryCategory);
}

get showDetailed() {
return this.cardStyle === "detailed";
}

get lastPoster() {
return this.args.topic.posters.find((poster) =>
poster.extras?.includes("latest")
);
}
}
40 changes: 20 additions & 20 deletions javascripts/discourse/components/kanban/controls.gjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import DButton from "discourse/components/d-button";
import CopyLinkButton from "./copy-link-button";
import DMenu from "float-kit/components/d-menu";
import Component from "@glimmer/component";
import KanbanOptionsModal from "./modal/options";
import { inject as service } from "@ember/service";
import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import DButton from "discourse/components/d-button";
import bodyClass from "discourse/helpers/body-class";
import { fn } from "@ember/helper";
import i18n from "discourse-common/helpers/i18n";
import DMenu from "float-kit/components/d-menu";
import CopyLinkButton from "./copy-link-button";
import KanbanOptionsModal from "./modal/options";

export default class KanbanControls extends Component {
@service modal;
@service kanbanManager;

@action
toggleFullscreen() {
this.kanbanManager.fullscreen = !this.kanbanManager.fullscreen;
}

@action
openSettings(menu) {
this.modal.show(KanbanOptionsModal);
menu.close();
}

<template>
{{#if this.kanbanManager.active}}
<DMenu
Expand Down Expand Up @@ -50,18 +64,4 @@ export default class KanbanControls extends Component {
{{/if}}
{{/if}}
</template>

@service modal;
@service kanbanManager;

@action
toggleFullscreen() {
this.kanbanManager.fullscreen = !this.kanbanManager.fullscreen;
}

@action
openSettings(menu) {
this.modal.show(KanbanOptionsModal);
menu.close();
}
}
24 changes: 12 additions & 12 deletions javascripts/discourse/components/kanban/copy-link-button.gjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import Component from "@glimmer/component";
import DButton from "discourse/components/d-button";
import { action } from "@ember/object";
import discourseDebounce from "discourse-common/lib/debounce";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import discourseDebounce from "discourse-common/lib/debounce";

export default class KanbanCopyLinkButton extends Component {
<template>
<DButton
@icon={{if this.copyConfirm "check" "copy"}}
class={{concatClass 'btn-transparent'}}
@action={{this.copy}}
@label={{themePrefix "copy_link"}}
/>
</template>

@tracked copyConfirm = false;

@action
Expand All @@ -29,4 +20,13 @@ export default class KanbanCopyLinkButton extends Component {
resetCopyButton() {
this.copyConfirm = false;
}

<template>
<DButton
@icon={{if this.copyConfirm "check" "copy"}}
class={{concatClass "btn-transparent"}}
@action={{this.copy}}
@label={{themePrefix "copy_link"}}
/>
</template>
}
23 changes: 10 additions & 13 deletions javascripts/discourse/components/kanban/list.gjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { inject as service } from "@ember/service";
import { modifier } from "ember-modifier";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import concatClass from "discourse/helpers/concat-class";
import { popupAjaxError } from "discourse/lib/ajax-error";
import Topic from "discourse/models/topic";
import I18n from "I18n";
import { action } from "@ember/object";
import icon from "discourse-common/helpers/d-icon";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DiscourseKanbanCard from "./card";
import i18n from "discourse-common/helpers/i18n";
import { on } from "@ember/modifier";
import { tracked } from "@glimmer/tracking";
import concatClass from "discourse/helpers/concat-class";
import { modifier } from "ember-modifier";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import I18n from "I18n";
import DiscourseKanbanCard from "./card";

function removedElements(before, after) {
if (!before) {
Expand Down Expand Up @@ -283,9 +283,6 @@ export default class KanbanList extends Component {
const listTitleHeight = mainOutlet
.querySelector(".list-title")
.getBoundingClientRect().height;
const topicsHeight = document
.querySelector(".topics")
.getBoundingClientRect().height;
const height =
mainOutletHeight -
listControlsHeight -
Expand Down
Loading

0 comments on commit 220369a

Please sign in to comment.