From df249f0f1ca8ea2822341dbf23a0e0c8db5e29ff Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 11 Oct 2022 15:19:58 +0200 Subject: [PATCH] final cleanup --- .../lib/components/homeTabFeaturedPlugins.tsx | 48 ++++-- .../src/lib/components/homeTabGetStarted.tsx | 39 ++++- .../src/lib/components/homeTabLearn.tsx | 4 +- .../src/lib/components/homeTabScamAlert.tsx | 2 +- .../src/lib/components/pluginButton.tsx | 14 +- .../home-tab/src/lib/components/rssFeed.css | 12 -- .../home-tab/src/lib/components/rssFeed.tsx | 42 ------ .../src/lib/components/workspaceTemplate.tsx | 3 - .../home-tab/src/lib/remix-ui-home-tab.tsx | 139 +----------------- 9 files changed, 80 insertions(+), 223 deletions(-) delete mode 100644 libs/remix-ui/home-tab/src/lib/components/rssFeed.css delete mode 100644 libs/remix-ui/home-tab/src/lib/components/rssFeed.tsx diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx index 337491e648..84b2fb4f57 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx @@ -47,11 +47,6 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { plugin.verticalIcons.select('solhint') _paq.push(['trackEvent', 'pluginManager', 'userActivate', 'solhint']) } - const startLearnEth = async () => { - await plugin.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting']) - plugin.verticalIcons.select('learnEth') - _paq.push(['trackEvent', 'pluginManager', 'userActivate', 'learnEth']) - } const startSourceVerify = async () => { await plugin.appManager.activatePlugin(['solidity', 'sourcify']) plugin.verticalIcons.select('sourcify') @@ -63,7 +58,7 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { _paq.push(['trackEvent', 'pluginManager', 'userActivate', 'solidityUnitTesting']) } - return ( + return (
@@ -84,11 +79,42 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { deviceType={"desktop"} itemClass="w-100" > - startSolidity()} /> - startStarkNet()} /> - startSolhint()} /> - startSourceVerify()} /> - startSolidityUnitTesting()} /> + startSolidity()} + /> + startStarkNet()} + /> + startSolhint()} + /> + startSourceVerify()} + /> + startSolidityUnitTesting()} + />
diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx index 92b4c2f6d2..4ae2a39550 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx @@ -53,15 +53,40 @@ function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { deviceType={"desktop"} itemClass="w-100" > - createWorkspace("blank")} /> - createWorkspace("remixDefault")} /> - createWorkspace("ozerc20")} /> - createWorkspace("ozerc721")} /> - createWorkspace("zeroxErc20")} /> - createWorkspace("")} /> + createWorkspace("blank")} /> + createWorkspace("remixDefault")} /> + createWorkspace("ozerc20")} /> + createWorkspace("ozerc721")} /> + createWorkspace("zeroxErc20")} /> + createWorkspace("")} /> -
+ + ) } diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx index b8c2143ee4..5140f9eafe 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx @@ -27,14 +27,14 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { const themeFilter = useContext(ThemeContext) const openLink = () => { - window.open("https://remix-ide.readthedocs.io/en/latest/remix_tutorials_learneth.html?highlight=learneth#learneth-tutorial-repos", '_blank') + window.open("https://remix-ide.readthedocs.io/en/latest/remix_tutorials_learneth.html?highlight=learneth#learneth-tutorial-repos", '_blank') } const startLearnEthTutorial = async (tutorial) => { await plugin.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting']) plugin.call('LearnEth', 'startTutorial', 'ethereum/remix-workshops', 'master', tutorial) plugin.verticalIcons.select('LearnEth') - _paq.push(['trackEvent', 'homeTab', 'startLearnEthTutorial']) + _paq.push(['trackEvent', 'homeTab', 'startLearnEthTutorial', tutorial]) } return ( diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabScamAlert.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabScamAlert.tsx index 18b01a1721..1caa8b3499 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabScamAlert.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabScamAlert.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import React, { useEffect, useState, useRef } from 'react' +import React from 'react' function HomeTabScamAlert () { return ( diff --git a/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx b/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx index a50f380ccc..803c9f7ec4 100644 --- a/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx @@ -30,13 +30,13 @@ function PluginButton ({ imgPath, envID, envText, callback, l2, description, rem { l2 && } { remixMaintained && - - Maintained by Remix - - }> - - + + Maintained by Remix + + }> + + } diff --git a/libs/remix-ui/home-tab/src/lib/components/rssFeed.css b/libs/remix-ui/home-tab/src/lib/components/rssFeed.css deleted file mode 100644 index 22e231c0e0..0000000000 --- a/libs/remix-ui/home-tab/src/lib/components/rssFeed.css +++ /dev/null @@ -1,12 +0,0 @@ -.RSSFeed-item img { - width: 100%; -} - -.RSSFeed-item .truncate { - max-height: 500px; - overflow: hidden; -} - -.RSSFeed-item .more-button { - -} \ No newline at end of file diff --git a/libs/remix-ui/home-tab/src/lib/components/rssFeed.tsx b/libs/remix-ui/home-tab/src/lib/components/rssFeed.tsx deleted file mode 100644 index 71df031d2f..0000000000 --- a/libs/remix-ui/home-tab/src/lib/components/rssFeed.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React, { useState, useEffect } from "react"; -import Parser from "rss-parser"; -import './rssFeed.css'; - -interface RSSFeedProps { - feedUrl: string, - maxItems: number, -} - -export function RSSFeed({ feedUrl, maxItems }: RSSFeedProps) { - const [feed, setFeed] = useState(null); - - useEffect(() => { - const fetchData = async () => { - const parser = new Parser() - const feed = await parser.parseURL(feedUrl); - for (const item of feed.items) { - item.content = item['content:encoded'] - item.date = new Date(item.pubDate).toLocaleDateString('en-US', { - month: 'short', - day: 'numeric' - }) - } - setFeed(feed); - }; - fetchData(); - }, [feedUrl]); - - - return (<> - {feed && feed.items.slice(0, maxItems).map((item: any, index: any) => ( -
-

{item.title}

-

Author: {item.creator}

-

{item.date}

-
- READ MORE -
-
- ))} - ) -} \ No newline at end of file diff --git a/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx b/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx index 293d5ddb1b..7aad479576 100644 --- a/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import React, { useContext } from 'react' -import { ThemeContext } from '../themeContext' -import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line interface WorkspaceTemplateProps { gsID: string, workspaceTitle: string, @@ -10,7 +8,6 @@ interface WorkspaceTemplateProps { } function WorkspaceTemplate ({ gsID, workspaceTitle, description, callback }: WorkspaceTemplateProps) { - const themeFilter = useContext(ThemeContext) return (
diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx index af3f81d7a3..b819ab63e9 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx @@ -1,8 +1,7 @@ -import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint-disable-line +import React, { useState, useEffect } from 'react' // eslint-disable-line import './remix-ui-home-tab.css' import { ThemeContext, themes } from './themeContext' -import { RSSFeed } from './components/rssFeed' import HomeTabTitle from './components/homeTabTitle' import HomeTabFile from './components/homeTabFile' import HomeTabLearn from './components/homeTabLearn' @@ -16,9 +15,7 @@ declare global { _paq: any } } -const _paq = window._paq = window._paq || [] //eslint-disable-line -/* eslint-disable-next-line */ export interface RemixUiHomeTabProps { plugin: any } @@ -28,14 +25,10 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { const [state, setState] = useState<{ themeQuality: { filter: string, name: string }, - showMediaPanel: 'none' | 'twitter' | 'medium' }>({ themeQuality: themes.light, - showMediaPanel: 'none' }) - const rightPanel = useRef(null) - useEffect(() => { plugin.call('theme', 'currentTheme').then((theme) => { // update theme quality. To be used for for images @@ -50,23 +43,6 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { return { ...prevState, themeQuality: theme.quality === 'dark' ? themes.dark : themes.light } }) }) - window.addEventListener('click', (event) => { - const target = event.target as Element - const id = target.id - if (id !== 'remixIDEHomeTwitterbtn' && id !== 'remixIDEHomeMediumbtn' && (rightPanel && rightPanel.current && !rightPanel.current.contains(event.target))) { - // todo check event.target - setState(prevState => { return { ...prevState, showMediaPanel: 'none' } }) - } - }) - // to retrieve twitter feed - const scriptTwitter = document.createElement('script') - scriptTwitter.src = 'https://platform.twitter.com/widgets.js' - scriptTwitter.async = true - document.body.appendChild(scriptTwitter) - - return () => { - document.body.removeChild(scriptTwitter) - } }, []) return ( @@ -89,116 +65,3 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { } export default RemixUiHomeTab - - -/* - - - const maxHeight = Math.max(window.innerHeight - 150, 250) + 'px' - const elHeight = '4000px' -
-
-
-
-
- -
- -
-
- playRemi() } alt=""> - -
-
-
-
-
-
-

Featured Plugins

-
- - startSolidity()} /> - startStarkNet()} /> - startSolhint()} /> - startLearnEth()} /> - startSourceVerify()} /> - - -
-
- ------------------------ -
-

Resources

-

- - Documentation -

-

- - Gitter channel -

-

- - Featuring website -

-
-
-
-
-
-
- - -
-
-
- -
- -
-
-
- */ \ No newline at end of file