ThemeLibrary: Fix CSS
This commit is contained in:
parent
5d67a3b556
commit
4bf6b70c4f
14 changed files with 66 additions and 102 deletions
|
|
@ -9,7 +9,7 @@ import "./styles.css";
|
|||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Button } from "@components/Button";
|
||||
import { ErrorBoundary } from "@components/index";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
|
@ -142,7 +142,7 @@ export default definePlugin({
|
|||
</Button>
|
||||
)}
|
||||
</Tooltip>
|
||||
</ErrorBoundary >
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Button } from "@components/Button";
|
||||
import { Heading } from "@components/Heading";
|
||||
import { Button } from "@components/index";
|
||||
import { Paragraph } from "@components/Paragraph";
|
||||
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
|
||||
interface ConfirmModalProps extends ModalProps {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Button } from "@components/Button";
|
||||
import { Heading } from "@components/Heading";
|
||||
import { Button } from "@components/index";
|
||||
import { classes } from "@utils/misc";
|
||||
import { openModal } from "@utils/modal";
|
||||
import { React, SelectedGuildStore, TextInput, useStateFromStores } from "@webpack/common";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import { showNotification } from "@api/Notifications";
|
|||
import { plugins } from "@api/PluginManager";
|
||||
import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList";
|
||||
import { migratePluginToSettings, Settings } from "@api/Settings";
|
||||
import { ErrorBoundary, openPluginModal } from "@components/index";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { openPluginModal } from "@components/settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { copyToClipboard } from "@utils/index";
|
||||
import definePlugin, { PluginNative, StartAt } from "@utils/types";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
import { defaultAudioNames, playAudio } from "@api/AudioPlayer";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Divider, ErrorBoundary, Heading, Paragraph } from "@components/index";
|
||||
import { Divider } from "@components/Divider";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Heading } from "@components/Heading";
|
||||
import { Paragraph } from "@components/Paragraph";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { makeRange, OptionType } from "@utils/types";
|
||||
import { Button, ColorPicker, ContextMenuApi, Menu, Select, Slider, TextInput, useEffect, useRef, useState } from "@webpack/common";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { ErrorBoundary } from "@components/index";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { findComponentByCodeLazy } from "@webpack";
|
||||
import { SearchableSelect, useState } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@
|
|||
*/
|
||||
|
||||
import * as DataStore from "@api/DataStore";
|
||||
import { Button } from "@components/Button";
|
||||
import { Margins } from "@components/margins";
|
||||
import type { Theme, ThemeLikeProps } from "@equicordplugins/themeLibrary/types";
|
||||
import { isAuthorized } from "@equicordplugins/themeLibrary/utils/auth";
|
||||
import { LikeIcon } from "@equicordplugins/themeLibrary/utils/Icons";
|
||||
import { Button, useEffect, useRef, useState } from "@webpack/common";
|
||||
import { useEffect, useRef, useState } from "@webpack/common";
|
||||
|
||||
import { logger, themeRequest } from "./ThemeTab";
|
||||
|
||||
|
|
@ -78,16 +80,13 @@ export const LikesComponent = ({ themeId, likedThemes: initialLikedThemes }: { t
|
|||
const hasLiked = likedThemes?.likes.some(like => like.themeId === themeId as unknown as Number && like?.hasLiked === true) ?? false;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={() => handleLikeClick(themeId)}
|
||||
size={Button.Sizes.MEDIUM}
|
||||
color={Button.Colors.PRIMARY}
|
||||
look={Button.Looks.FILLED}
|
||||
disabled={themeId === "preview"}
|
||||
style={{ marginLeft: "8px" }}
|
||||
>
|
||||
{LikeIcon(hasLiked || themeId === "preview")} {themeId === "preview" ? 143 : likesCount}
|
||||
</Button>
|
||||
</div>
|
||||
<Button onClick={() => handleLikeClick(themeId)}
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
disabled={themeId === "preview"}
|
||||
className={Margins.right8}
|
||||
>
|
||||
{LikeIcon(hasLiked || themeId === "preview")} {themeId === "preview" ? 143 : likesCount}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
import { generateId } from "@api/Commands";
|
||||
import { Settings } from "@api/Settings";
|
||||
import { Button } from "@components/Button";
|
||||
import { Card } from "@components/Card";
|
||||
import { HeadingPrimary, HeadingTertiary } from "@components/Heading";
|
||||
import { OpenExternalIcon } from "@components/Icons";
|
||||
import { Paragraph } from "@components/Paragraph";
|
||||
import type { Theme, ThemeLikeProps } from "@equicordplugins/themeLibrary/types";
|
||||
import { proxyLazy } from "@utils/lazy";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { User } from "@vencord/discord-types";
|
||||
import { Button, FluxDispatcher, Parser, React, UserStore, UserUtils } from "@webpack/common";
|
||||
import { FluxDispatcher, Parser, React, UserStore, UserUtils } from "@webpack/common";
|
||||
import { Constructor } from "type-fest";
|
||||
|
||||
import { LikesComponent } from "./LikesComponent";
|
||||
|
|
@ -77,8 +77,7 @@ export const ThemeCard: React.FC<ThemeCardProps> = ({ theme, themeLinks, likedTh
|
|||
</ModalContent>
|
||||
<ModalFooter>
|
||||
<Button
|
||||
look={Button.Looks.FILLED}
|
||||
color={Button.Colors.GREEN}
|
||||
variant="positive"
|
||||
onClick={() => {
|
||||
Settings.plugins.ThemeAttributes.enabled = true;
|
||||
modalProps.onClose();
|
||||
|
|
@ -88,8 +87,7 @@ export const ThemeCard: React.FC<ThemeCardProps> = ({ theme, themeLinks, likedTh
|
|||
Enable Plugin
|
||||
</Button>
|
||||
<Button
|
||||
color={Button.Colors.RED}
|
||||
look={Button.Looks.FILLED}
|
||||
variant="dangerPrimary"
|
||||
className={Margins.right8}
|
||||
onClick={() => modalProps.onClose()}
|
||||
>
|
||||
|
|
@ -117,10 +115,10 @@ export const ThemeCard: React.FC<ThemeCardProps> = ({ theme, themeLinks, likedTh
|
|||
|
||||
return (
|
||||
<Card style={{ padding: ".5rem", marginBottom: ".5em", marginTop: ".5em", display: "flex", flexDirection: "column", backgroundColor: "var(--background-base-lower-alt)" }} key={theme.id}>
|
||||
<HeadingPrimary style={{ overflowWrap: "break-word", marginTop: 8 }} className="vce-theme-text">
|
||||
<HeadingPrimary style={{ overflowWrap: "break-word", marginTop: "8px" }} className="vce-theme-text-title">
|
||||
{theme.name}
|
||||
</HeadingPrimary>
|
||||
<Paragraph className="vce-theme-text">
|
||||
<Paragraph className="vce-theme-text-description">
|
||||
{Parser.parse(theme.description)}
|
||||
</Paragraph>
|
||||
{!removePreview && (
|
||||
|
|
@ -141,9 +139,8 @@ export const ThemeCard: React.FC<ThemeCardProps> = ({ theme, themeLinks, likedTh
|
|||
<div style={{ marginTop: "8px", display: "flex", flexDirection: "row" }}>
|
||||
<Button
|
||||
onClick={handleThemeAttributesCheck}
|
||||
size={Button.Sizes.MEDIUM}
|
||||
color={themeLinks.includes(`${apiUrl}/${theme.id}`) ? Button.Colors.RED : Button.Colors.GREEN}
|
||||
look={Button.Looks.FILLED}
|
||||
size="medium"
|
||||
variant={themeLinks.includes(`${apiUrl}/${theme.id}`) ? "dangerPrimary" : "positive"}
|
||||
className={Margins.right8}
|
||||
disabled={!theme.content || theme.id === "preview"}
|
||||
>
|
||||
|
|
@ -157,22 +154,20 @@ export const ThemeCard: React.FC<ThemeCardProps> = ({ theme, themeLinks, likedTh
|
|||
|
||||
openModal(props => <ThemeInfoModal {...props} author={authors} theme={theme} />);
|
||||
}}
|
||||
size={Button.Sizes.MEDIUM}
|
||||
color={Button.Colors.BRAND}
|
||||
look={Button.Looks.FILLED}
|
||||
size="medium"
|
||||
className={Margins.right8}
|
||||
>
|
||||
Theme Info
|
||||
</Button>
|
||||
<LikesComponent themeId={theme.id} likedThemes={likedThemes} />
|
||||
<Button
|
||||
onClick={handleViewSource}
|
||||
size={Button.Sizes.MEDIUM}
|
||||
color={Button.Colors.LINK}
|
||||
look={Button.Looks.LINK}
|
||||
size="medium"
|
||||
variant="link"
|
||||
disabled={!theme.content || theme.id === "preview"}
|
||||
style={{ display: "flex", alignItems: "center", justifyContent: "center" }}
|
||||
>
|
||||
View Source <OpenExternalIcon height={16} width={16} />
|
||||
View Source
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ import { HeadingPrimary, HeadingTertiary } from "@components/Heading";
|
|||
import { OpenExternalIcon } from "@components/Icons";
|
||||
import { Paragraph } from "@components/Paragraph";
|
||||
import { SettingsTab, wrapTab } from "@components/settings";
|
||||
import { SearchStatus, TabItem, Theme, ThemeLikeProps } from "@equicordplugins/themeLibrary/types";
|
||||
import { SearchStatus, Theme, ThemeLikeProps } from "@equicordplugins/themeLibrary/types";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import { findCssClassesLazy } from "@webpack";
|
||||
import { Button, React, SearchableSelect, TabBar, TextInput, useEffect, useState } from "@webpack/common";
|
||||
import { Button, React, SearchableSelect, TextInput, useEffect, useState } from "@webpack/common";
|
||||
|
||||
import { ThemeCard } from "./ThemeCard";
|
||||
|
||||
|
|
@ -262,63 +262,10 @@ function ThemeTab() {
|
|||
);
|
||||
}
|
||||
|
||||
// rework this!
|
||||
function SubmitThemes() {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
height: "70vh",
|
||||
fontSize: "1.5em",
|
||||
color: "var(--text-default)"
|
||||
}}>
|
||||
<p>
|
||||
This tab was replaced in favour of the new website:
|
||||
{" "}
|
||||
<a href="https://themes.equicord.org" target="_blank" rel="noreferrer">
|
||||
themes.equicord.org
|
||||
</a>
|
||||
</p>
|
||||
<p style={{
|
||||
fontSize: ".75em",
|
||||
color: "var(--text-muted)"
|
||||
}}>
|
||||
Thank you for your understanding!
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ThemeLibrary() {
|
||||
const [currentTab, setCurrentTab] = useState(TabItem.THEMES);
|
||||
|
||||
return (
|
||||
<SettingsTab>
|
||||
<TabBar
|
||||
type="top"
|
||||
look="brand"
|
||||
className="vc-settings-tab-bar"
|
||||
selectedItem={currentTab}
|
||||
onItemSelect={setCurrentTab}
|
||||
>
|
||||
<TabBar.Item
|
||||
className="vc-settings-tab-bar-item"
|
||||
id={TabItem.THEMES}
|
||||
>
|
||||
Themes
|
||||
</TabBar.Item>
|
||||
<TabBar.Item
|
||||
className="vc-settings-tab-bar-item"
|
||||
id={TabItem.SUBMIT_THEMES}
|
||||
>
|
||||
Submit Theme
|
||||
</TabBar.Item>
|
||||
</TabBar>
|
||||
|
||||
{currentTab === TabItem.THEMES ? <ThemeTab /> : <SubmitThemes />}
|
||||
<ThemeTab />
|
||||
</SettingsTab>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,15 @@
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
.vce-theme-text {
|
||||
.vce-theme-text-title {
|
||||
padding: 0.5rem;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.vce-theme-text-description {
|
||||
padding: 0.5rem;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.vce-theme-info-tag {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Flex } from "@components/Flex";
|
||||
import { HeadingPrimary } from "@components/Heading";
|
||||
import { Heart } from "@components/Heart";
|
||||
import { DonateButton, ErrorBoundary, HeadingPrimary, Paragraph } from "@components/index";
|
||||
import { Paragraph } from "@components/Paragraph";
|
||||
import { DonateButton } from "@components/settings";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { closeModal, ModalContent, ModalFooter, ModalHeader, ModalRoot, openModal } from "@utils/modal";
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
import { showNotification } from "@api/Notifications";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { openInviteModal } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { closeAllModals } from "@utils/modal";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { maybePromptToUpdate } from "@utils/updater";
|
||||
import { filters, findBulk, proxyLazyWebpack } from "@webpack";
|
||||
import { DraftType, ExpressionPickerStore, FluxDispatcher, NavigationRouter, SelectedChannelStore } from "@webpack/common";
|
||||
import { DraftType, ExpressionPickerStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, showToast } from "@webpack/common";
|
||||
|
||||
const CrashHandlerLogger = new Logger("CrashHandler");
|
||||
|
||||
|
|
@ -98,8 +99,11 @@ export default definePlugin({
|
|||
showNotification({
|
||||
color: "#eed202",
|
||||
title: "Discord has crashed!",
|
||||
body: "Awn :( Discord has crashed two times rapidly, not attempting to recover.",
|
||||
noPersist: true
|
||||
body: "Awn :( Discord has crashed two times rapidly, not attempting to recover. Click here to join our support server!",
|
||||
noPersist: true,
|
||||
onClick: () => openInviteModal("wKgT9j2xfN").catch(() =>
|
||||
showToast("Invalid or expired invite"),
|
||||
)
|
||||
});
|
||||
} catch { }
|
||||
|
||||
|
|
@ -133,8 +137,11 @@ export default definePlugin({
|
|||
showNotification({
|
||||
color: "#eed202",
|
||||
title: "Discord has crashed!",
|
||||
body: "Attempting to recover...",
|
||||
noPersist: true
|
||||
body: "Attempting to recover... Click here to join our support server!",
|
||||
noPersist: true,
|
||||
onClick: () => openInviteModal("wKgT9j2xfN").catch(() =>
|
||||
showToast("Invalid or expired invite"),
|
||||
)
|
||||
});
|
||||
} catch { }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co
|
|||
import { DataStore } from "@api/index";
|
||||
import { isPluginEnabled } from "@api/PluginManager";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Button, ErrorBoundary, Heading, TextButton } from "@components/index";
|
||||
import { Button, TextButton } from "@components/Button";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Heading } from "@components/Heading";
|
||||
import mentionAvatars from "@plugins/mentionAvatars";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { classNameFactory, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/index";
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption,
|
|||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { plugins } from "@api/PluginManager";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { openPluginModal } from "@components/index";
|
||||
import { openPluginModal } from "@components/settings";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Channel } from "@vencord/discord-types";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue