From: SleeplessOne1917 Date: Tue, 4 Apr 2023 12:40:00 +0000 (-0400) Subject: Multiple image upload (#971) X-Git-Url: http://these/git/%22%7Burl%7D/%7B%60%24%7BghostArchiveUrl%7D/%7BelementUrl%7D?a=commitdiff_plain;h=699c3ff4b1a6e0c2a8e9699f326f1edbb63a826e;p=lemmy-ui.git Multiple image upload (#971) * feat: Add multiple image upload * refactor: Slight cleanup * feat: Add progress bar for multi-image upload * fix: Fix progress bar * fix: Messed up fix last time * refactor: Use await where possible * Update translation logic * Did suggested PR changes * Updating translations * Fix i18 issue * Make prettier actually check src in hopes it will fix CI issue --- diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a14ae90 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +src/shared/translations \ No newline at end of file diff --git a/package.json b/package.json index 0e0426a..573858b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build:prod": "webpack --mode=production", "clean": "yarn run rimraf dist", "dev": "yarn start", - "lint": "node generate_translations.js && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check 'src/**/*.tsx'", + "lint": "node generate_translations.js && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check \"src/**/*.{ts,tsx}\"", "prepare": "husky install", "start": "yarn build:dev --watch" }, diff --git a/src/shared/components/common/emoji-picker.tsx b/src/shared/components/common/emoji-picker.tsx index 1149583..aea986a 100644 --- a/src/shared/components/common/emoji-picker.tsx +++ b/src/shared/components/common/emoji-picker.tsx @@ -5,6 +5,7 @@ import { Icon } from "./icon"; interface EmojiPickerProps { onEmojiClick?(val: any): any; + disabled?: boolean; } interface EmojiPickerState { @@ -15,8 +16,9 @@ export class EmojiPicker extends Component { private emptyState: EmojiPickerState = { showPicker: false, }; + state: EmojiPickerState; - constructor(props: any, context: any) { + constructor(props: EmojiPickerProps, context: any) { super(props, context); this.state = this.emptyState; this.handleEmojiClick = this.handleEmojiClick.bind(this); @@ -28,6 +30,7 @@ export class EmojiPicker extends Component { className="btn btn-sm text-muted" data-tippy-content={i18n.t("emoji")} aria-label={i18n.t("emoji")} + disabled={this.props.disabled} onClick={linkEvent(this, this.togglePicker)} > diff --git a/src/shared/components/common/language-select.tsx b/src/shared/components/common/language-select.tsx index 64cbac4..feada32 100644 --- a/src/shared/components/common/language-select.tsx +++ b/src/shared/components/common/language-select.tsx @@ -10,11 +10,12 @@ interface LanguageSelectProps { allLanguages: Language[]; siteLanguages: number[]; selectedLanguageIds?: number[]; - multiple: boolean; + multiple?: boolean; onChange(val: number[]): any; showAll?: boolean; showSite?: boolean; iconVersion?: boolean; + disabled?: boolean; } export class LanguageSelect extends Component { @@ -55,19 +56,19 @@ export class LanguageSelect extends Component { )}
{this.selectBtn} {this.props.multiple && ( @@ -87,8 +88,8 @@ export class LanguageSelect extends Component { } get selectBtn() { - let selectedLangs = this.props.selectedLanguageIds; - let filteredLangs = selectableLanguages( + const selectedLangs = this.props.selectedLanguageIds; + const filteredLangs = selectableLanguages( this.props.allLanguages, this.props.siteLanguages, this.props.showAll, @@ -98,14 +99,17 @@ export class LanguageSelect extends Component { return (