mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -04:00
Fixes
This commit is contained in:
parent
ca157b33f7
commit
11dc0e9ea6
6 changed files with 23 additions and 35 deletions
|
@ -11,7 +11,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
|||
### Extra included plugins
|
||||
|
||||
<details>
|
||||
<summary>182 additional plugins</summary>
|
||||
<summary>183 additional plugins</summary>
|
||||
|
||||
### All Platforms
|
||||
|
||||
|
@ -41,6 +41,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
|||
- CommandPalette by Ethan
|
||||
- CopyStickerLinks by Byeoon
|
||||
- CopyUserMention by Cortex & castdrian
|
||||
- CustomFolderIcons by sadan
|
||||
- CustomSounds by TheKodeToad & SpikeHD
|
||||
- CustomTimestamps by Rini & nvhrr
|
||||
- CustomUserColors by mochienya
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# CustomFolderIcons
|
||||
|
||||
Allows you to set custom images/svgs as folder icons
|
||||
|
||||
Available as "Change Icon" in the folder context menu
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
import { closeModal, ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
|
||||
import { Button, Menu, Slider, TextInput, useState } from "@webpack/common";
|
||||
|
||||
import settings, { folderIconsData } from "./settings";
|
||||
import { folderIconsData, settings } from "./settings";
|
||||
import { folderProp, int2rgba, setFolderData } from "./util";
|
||||
|
||||
export function ImageModal(folderProps: folderProp) {
|
||||
|
@ -81,7 +81,7 @@ export function RenderPreview({ folderProps, url, size }: { folderProps: folderP
|
|||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}>
|
||||
<img src={url} width={`${size}%`} height={`${size}%`} />
|
||||
<img alt="" src={url} width={`${size}%`} height={`${size}%`} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -93,18 +93,18 @@ export function makeContextItem(a: folderProp) {
|
|||
key="custom-folder-icons"
|
||||
label="Change Icon"
|
||||
action={() => {
|
||||
openModalLazy(async() => {
|
||||
openModalLazy(async () => {
|
||||
return props => (
|
||||
<ModalRoot {...props}>
|
||||
<ModalHeader >
|
||||
<div style={{
|
||||
color: "white"
|
||||
}}>
|
||||
Set a New Icon.
|
||||
Set a New Icon.
|
||||
</div>
|
||||
</ModalHeader>
|
||||
<ModalContent>
|
||||
<ImageModal folderId={a.folderId} folderColor={a.folderColor}/>
|
||||
<ImageModal folderId={a.folderId} folderColor={a.folderColor} />
|
||||
</ModalContent>
|
||||
<div style={{
|
||||
color: "white",
|
||||
|
@ -116,9 +116,9 @@ export function makeContextItem(a: folderProp) {
|
|||
</ModalRoot>
|
||||
);
|
||||
},
|
||||
{
|
||||
modalKey: "custom-folder-icon"
|
||||
});
|
||||
}}/>
|
||||
{
|
||||
modalKey: "custom-folder-icon"
|
||||
});
|
||||
}} />
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ import { EquicordDevs } from "@utils/constants";
|
|||
import definePlugin from "@utils/types";
|
||||
|
||||
import { makeContextItem } from "./components";
|
||||
import settings, { folderIconsData } from "./settings";
|
||||
import { folderIconsData, settings } from "./settings";
|
||||
import { folderProp, int2rgba } from "./util";
|
||||
|
||||
export default definePlugin({
|
||||
settings,
|
||||
name: "CustomFolderIcons",
|
||||
description: "Customize folder icons with any png",
|
||||
authors: [EquicordDevs.sadan],
|
||||
settings,
|
||||
patches: [
|
||||
{
|
||||
find: ".folderButtonInner",
|
||||
|
@ -49,7 +49,7 @@ export default definePlugin({
|
|||
height: "100%"
|
||||
}}
|
||||
>
|
||||
<img src={data!.url} width={`${data!.size ?? 100}%`} height={`${data!.size ?? 100}%`}
|
||||
<img alt="" src={data!.url} width={`${data!.size ?? 100}%`} height={`${data!.size ?? 100}%`}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { OptionType } from "@utils/types";
|
||||
|
||||
export interface folderIcon{
|
||||
export interface folderIcon {
|
||||
url: string,
|
||||
size: number,
|
||||
}
|
||||
export type folderIconsData = Record<string, folderIcon | null>;
|
||||
|
||||
const settings = definePluginSettings({
|
||||
export const settings = definePluginSettings({
|
||||
solidIcon: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false,
|
||||
|
@ -26,4 +26,3 @@ const settings = definePluginSettings({
|
|||
component: () => <></>
|
||||
}
|
||||
});
|
||||
export default settings;
|
||||
|
|
|
@ -4,23 +4,25 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import settings, { folderIcon, folderIconsData } from "./settings";
|
||||
import { folderIcon, folderIconsData, settings } from "./settings";
|
||||
|
||||
export async function setFolderData(props: folderProp, newData: folderIcon) {
|
||||
if (!settings.store.folderIcons){
|
||||
if (!settings.store.folderIcons) {
|
||||
settings.store.folderIcons = {};
|
||||
}
|
||||
const folderSettings = (settings.store.folderIcons as folderIconsData);
|
||||
folderSettings[props.folderId] = newData;
|
||||
}
|
||||
|
||||
export interface folderProp {
|
||||
folderId: string;
|
||||
folderColor: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rgbVal RGB value
|
||||
* @param alpha alpha bewteen zero and 1
|
||||
*/
|
||||
* @param rgbVal RGB value
|
||||
* @param alpha alpha bewteen zero and 1
|
||||
*/
|
||||
export function int2rgba(rgbVal: number, alpha: number = 1) {
|
||||
const b = rgbVal & 0xFF,
|
||||
g = (rgbVal & 0xFF00) >>> 8,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue