finish converting over to the "new" modals (I think)

pull/95/head
dperolio 2 years ago
parent a90427c626
commit c3185d703a
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -1,8 +1,8 @@
/**
*
*
*/
import { open as openModal, close as closeModal } from '@vizality/modal';
import { openModal } from '@vizality/modal';
import { getModule, getModuleByDisplayName } from '@vizality/webpack';
import { Directories, Events, Protocols } from '@vizality/constants';
import { joinClassNames } from '@vizality/util/dom';
@ -26,7 +26,7 @@ export default class Updater extends Builtin {
constructor () {
super();
this.changelog = {
image: `${Protocols.ASSETS}/${this.addonId}/assets/updates-2021-01-11.png`,
image: `${Protocols.BUILTINS}/${this.addonId}/assets/updates-2021-01-11.png`,
id: 'updates-2021-01-11'
};
this.checking = false;
@ -109,7 +109,7 @@ export default class Updater extends Builtin {
const updates = [];
const addonsLength = addons.length;
const parallel = allConcurrent ? addonsLength : this.settings.get('concurrency', 2);
await Promise.all(Array(parallel).fill(null).map(async () => {
Promise.all(Array(parallel).fill(null).map(async () => {
let addon;
while ((addon = addons.shift())) {
const repo = await addon.getGitRepo();
@ -250,7 +250,7 @@ export default class Updater extends Builtin {
// MODALS
/**
*
*
* @param {VizalityUpdate} [update] Update
* @param {Function} [callback] Callback function
*/
@ -354,10 +354,9 @@ export default class Updater extends Builtin {
// Change Log
async openLatestChangelog () {
const { openModal: openNewModal } = getModule('openModal', 'closeModal');
const changelogObject = await this.formatChangelog();
const ChangeLog = await this._getChangeLogsComponent();
openNewModal(props => <ChangeLog changeLog={changelogObject} {...props} />);
openModal(() => props => <ChangeLog changeLog={changelogObject} {...props} />);
}
async _getChangeLogsComponent () {

@ -7,7 +7,7 @@ import fs, { stat, renameSync, readFileSync, existsSync, lstatSync, readdirSync
import { AddonInfoMessage, AddonUninstallModal } from '@vizality/components/addon';
import { removeDirRecursive } from '@vizality/util/file';
import { log, warn, error } from '@vizality/util/logger';
import { openModalLazy as openModal } from '@vizality/modal';
import { openModal } from '@vizality/modal';
import { isArray } from '@vizality/util/array';
import { Avatars, Events as _Events, Protocols } from '@vizality/constants';
import http from 'isomorphic-git/http/node';
@ -927,9 +927,8 @@ export default class AddonManager extends Events {
if (!addon) {
return;
}
if (!openModal) return this._error(`Can't find DeprecatedModal module within Discord`)
openModal(() => ModalArgs => <AddonUninstallModal {...ModalArgs} addon={addon} type={this.type} />);
openModal(() => props => <AddonUninstallModal {...props} addon={addon} type={this.type} />);
} catch (err) {
return this._error(err);
}

@ -1,4 +1,4 @@
import { __TabBar, StickyElement, ImageCarouselModal, Image, Markdown } from '@vizality/components';
import { __TabBar, StickyElement, ImageModal, Image, Markdown } from '@vizality/components';
import { Section } from '@vizality/components/dashboard';
import React, { memo } from 'react';
import { openModal } from '@vizality/modal';
@ -8,28 +8,13 @@ import { useRouteMatch } from 'react-router';
import { Messages } from '@vizality/i18n';
const AddonScreenshots = memo(({ addon }) => {
const Carousel = (items, startsWith, props) => {
return (
<ImageCarouselModal
className={joinClassNames('vz-image-modal', 'vz-modal-image-carousel')}
items={[ ...items.map(item => {
return {
src: item
};
}) ]}
startWith={startsWith}
{...props}
/>
);
};
return (
<div className='vz-addon-listing-screenshots-grid-wrapper'>
{addon?.manifest?.screenshots?.map((image, index) =>
<Image
className='vz-image-wrapper'
src={image}
onClick={() => openModal(props => Carousel(addon?.manifest?.screenshots, index, props))}
onClick={() => openModal(() => <ImageModal src={addon.manifest.screenshots[index]} />)}
/>
)}
</div>

@ -1,7 +1,8 @@
import { toTitleCase, toPlural } from '@vizality/util/string';
import { Messages } from '@vizality/i18n';
import { AddonInfoMessage } from '.';
import React, { memo } from 'react';
import { AddonInfoMessage } from '.';
import { Confirm } from '..';
/**
@ -11,9 +12,10 @@ import { Confirm } from '..';
* @param {object} props.addon Addon
* @param {string} props.type Addon type
*/
export default memo(({ onClose, addon, type }) => {
export default memo(({ onClose, addon, type, ...props }) => {
return (
<Confirm
{...props}
header={Messages.VIZALITY_ADDON_UNINSTALL.format({ type: toTitleCase(type) })}
confirmText={Messages.VIZALITY_UNINSTALL}
cancelText={Messages.CANCEL}

Loading…
Cancel
Save