Advertisement
12944qwerty

Untitled

Apr 24th, 2022
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { React } = require('powercord/webpack');
  2.  
  3. const ThemeCard = require('./ThemeCard');
  4.  
  5. module.exports = class Settings extends React.PureComponent {
  6.     constructor(props) {
  7.         super(props);
  8.  
  9.         const themes = [
  10.             {
  11.                 name: "CreArts",
  12.                 key: "CreArts-Discord",
  13.                 preview: "https://media.discordapp.net/attachments/967811356055203910/967879636711243826/unknown.png?width=952&height=614",
  14.                 url: null,
  15.             }
  16.         ]
  17.  
  18.         this.state = {themes: themes}
  19.     }
  20.  
  21.     async componentDidMount() {
  22.         let themes = this.state.themes
  23.         await Promise.all([ ...themes.map(async (theme) => {
  24.             const pctheme = powercord.styleManager.themes.get(theme.key);
  25.             const repo = await pctheme.getGitRepo();
  26.             const url = `https://github.com/${repo}`;
  27.            
  28.             theme.url = url;
  29.  
  30.             return theme;
  31.         })]);
  32.         this.setState({themes:themes});
  33.         this.forceUpdate();
  34.     }
  35.  
  36.     render() {
  37.         const { main } = this.props;
  38.  
  39.         if (this.state.themes.some((theme) => theme.url === null)) {
  40.             return null;
  41.         }
  42.  
  43.         return (
  44.             <div class="skin-toggler-gallery">
  45.                 {this.state.themes.map(async (theme) => {
  46.                     console.log(theme)
  47.                     const pctheme = powercord.styleManager.themes.get(theme.key);
  48.                    
  49.                     return <>
  50.                         <ThemeCard
  51.                             url={theme.url}
  52.                             preview={theme.preview}
  53.                             name={theme.name}
  54.                             main={main}
  55.                             theme={pctheme}
  56.                         />
  57.                     </>
  58.                 })}
  59.                
  60.             </div>
  61.         )
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement