Skip to content

Commit

Permalink
Chore: Lee's code sweep (during Hacktoberfest '24) (#2450)
Browse files Browse the repository at this point in the history
* Removed my outdated TODO comments

* Manifest Picker code tidy-up

* Attribute tidy-up

Things I'd picked up during development

* Corrects Storybook control type for `umb-localize` key

* Ran `npm run lint:fix`
  • Loading branch information
leekelleher authored Oct 14, 2024
1 parent 59bfc93 commit 704a854
Show file tree
Hide file tree
Showing 17 changed files with 1,657 additions and 1,571 deletions.
6 changes: 4 additions & 2 deletions examples/manifest-picker/manifest-picker-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { css, html, customElement, state, when, nothing } from '@umbraco-cms/backoffice/external/lit';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbInputManifestElement } from '@umbraco-cms/backoffice/components';
import type { UmbInputManifestElement } from '@umbraco-cms/backoffice/components';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui';
import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui';

// eslint-disable-next-line local-rules/enforce-umb-prefix-on-element-name
@customElement('example-manifest-picker-dashboard')
// eslint-disable-next-line local-rules/enforce-element-suffix-on-element-class-name, local-rules/umb-class-prefix
export class ExampleManifestPickerDashboard extends UmbLitElement {
#options: Array<Option> = [];

Expand Down
1 change: 0 additions & 1 deletion src/apps/preview/preview.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export class UmbPreviewContext extends UmbContextBase<UmbPreviewContext> {
window.open(url, '_blank');
}

// TODO: [LK] Figure out how to make `iframe.contentDocument` works, as it's not from SameOrigin.
reloadIFrame(iframe: HTMLIFrameElement) {
const document = iframe.contentDocument;
if (!document) return;
Expand Down
3,160 changes: 1,625 additions & 1,535 deletions src/assets/lang/ar.ts

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/packages/core/collection/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ export interface UmbCollectionConfiguration {
export interface UmbCollectionColumnConfiguration {
alias: string;
header: string;
// TODO: [LK] Figure out why the server API needs an int (1|0) instead of a boolean.
isSystem: 1 | 0;
elementName?: string;
// TODO: [LK] Remove `nameTemplate`, to be replaced with `elementName`.
nameTemplate?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/localization/manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,5 @@ export const manifests: Array<ManifestLocalization> = [
culture: 'zh-tw',
},
js: () => import('../../../assets/lang/zh-tw.js'),
}
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const meta: Meta<UmbLocalizeElement> = {
argTypes: {
args: {
control: {
type: 'array',
type: 'text',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ManifestMenu } from '../menu.extension.js';
import type { ManifestSectionSidebarAppBaseMenu, ManifestSectionSidebarAppMenuKind } from './types.js';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { css, html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { ManifestMenu } from '../menu.extension.js';

// TODO: Move to separate file:
const manifest: UmbExtensionManifestKind = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class UmbSectionSidebarContextMenuElement extends UmbLitElement {
display: flex;
align-items: center;
}
#action-modal umb-entity-action-list{
#action-modal umb-entity-action-list {
--uui-menu-item-flat-structure: 0;
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class UmbDocumentTypeWorkspaceEditorElement extends UmbLitElement {
.value=${this._name}
.alias=${this._alias}
?auto-generate-alias=${this._isNew}
@change="${this.#onNameAndAliasChange}"
@change=${this.#onNameAndAliasChange}
required
${umbBindToValidation(this, '$.name', this._name)}
${umbFocus()}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,19 @@ export class UmbDocumentTypeWorkspaceViewTemplatesElement extends UmbLitElement

#renderTemplates() {
return html`
<uui-box headline="${this.localize.term('treeHeaders_templates')}">
<uui-box headline=${this.localize.term('treeHeaders_templates')}>
${when(
this.#workspaceContext?.createTemplateMode,
() => html`<p><em>The default template will be created once this document type has been saved.</em></p>`,
)}
<umb-property-layout
alias="Templates"
label="${this.localize.term('contentTypeEditor_allowedTemplatesHeading')}">
<umb-property-layout alias="Templates" label=${this.localize.term('contentTypeEditor_allowedTemplatesHeading')}>
<div slot="description">${this.localize.term('contentTypeEditor_allowedTemplatesDescription')}</div>
<div id="templates" slot="editor">
<umb-input-template
.defaultUnique=${this._defaultTemplateId ?? ''}
.selection=${this._allowedTemplateIds}
@change=${this.#templateInputChange}></umb-input-template>
@change=${this.#templateInputChange}>
</umb-input-template>
</div>
</umb-property-layout>
</uui-box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class UmbMediaTypeWorkspaceEditorElement extends UmbLitElement {
value=${this._name}
alias=${this._alias}
?auto-generate-alias=${this._isNew}
@change="${this.#onNameAndAliasChange}"
@change=${this.#onNameAndAliasChange}
${umbFocus()}>
</umb-input-with-alias>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class UmbImageCropperFocusSetterElement extends LitElement {
@property({ attribute: false })
focalPoint: UmbImageCropperFocalPoint = { left: 0.5, top: 0.5 };

// TODO: [LK] Temporary fix; to be reviewed.
@property({ type: Boolean })
hideFocalPoint = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class UmbMemberTypeWorkspaceEditorElement extends UmbLitElement {
value=${this._name}
alias=${this._alias}
?auto-generate-alias=${this._isNew}
@change="${this.#onNameAndAliasChange}"
@change=${this.#onNameAndAliasChange}
${umbFocus()}>
</umb-input-with-alias>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class UmbInputContentPickerSourceElement extends UUIFormControlMixin(UmbL

override render() {
return html`<umb-input-dropdown-list
@change="${this.#onContentTypeChange}"
@change=${this.#onContentTypeChange}
.options=${this._options}></umb-input-dropdown-list>
${this.#renderSourcePicker()}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ export class UmbInputTemplateElement extends UUIFormControlMixin(UmbLitElement,
${this._pickedTemplates.map(
(template) => html`
<umb-template-card
.name=${template.name}
.id=${template.unique}
@open=${() => window.history.pushState({}, '', this.#templatePath + 'edit/' + template.unique)}
.name=${template.name}
@change=${this.#onCardChange}
?default="${template.unique === this.defaultUnique}">
@open=${() => window.history.pushState({}, '', this.#templatePath + 'edit/' + template.unique)}
?default=${template.unique === this.defaultUnique}>
<uui-button
slot="actions"
label="${this.localize.term('general_remove') + ' ' + template.name}"
@click="${() => this.#removeTemplate(template.unique ?? '')}"
compact>
compact
label=${this.localize.term('general_remove') + ' ' + template.name}
@click=${() => this.#removeTemplate(template.unique ?? '')}>
<uui-icon name="icon-trash"></uui-icon>
</uui-button>
</umb-template-card>
Expand All @@ -191,8 +191,8 @@ export class UmbInputTemplateElement extends UUIFormControlMixin(UmbLitElement,
<uui-button
id="btn-add"
look="placeholder"
label="${this.localize.term('general_add')}"
@click="${this.#openPicker}"></uui-button>
label=${this.localize.term('general_choose')}
@click=${this.#openPicker}></uui-button>
`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ export class UmbPropertyEditorUITinyMceToolbarConfigurationElement

override render() {
return html`<ul>
${repeat(
this._toolbarConfig,
(v) => v.alias,
${repeat(
this._toolbarConfig,
(v) => v.alias,
(v) =>
html`<li>
<uui-checkbox label=${v.label} value=${v.alias} ?checked=${v.selected} @change=${this.onChange}>
<uui-icon .svg=${tinyIconSet?.icons[v.icon ?? 'alignjustify']}></uui-icon>
<uui-checkbox label=${v.label} value=${v.alias} ?checked=${v.selected} @change=${this.onChange}>
<uui-icon .svg=${tinyIconSet?.icons[v.icon ?? 'alignjustify']}></uui-icon>
${v.label}
</uui-checkbox>
</uui-checkbox>
</li>`,
)}
)}
</ul>`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ export class UmbUserGridCollectionViewElement extends UmbLitElement {

return html`<div class="user-login-time">
<umb-localize key="user_lastLogin"></umb-localize>
${this.localize.date(user.lastLoginDate)}
${formattedTime}
${this.localize.date(user.lastLoginDate)} ${formattedTime}
</div>`;
}

Expand Down

0 comments on commit 704a854

Please sign in to comment.