From d203d843794b2b02ec17ef12bd6ed80fe6afa70d Mon Sep 17 00:00:00 2001 From: Rohan Lekhwani Date: Thu, 6 May 2021 13:40:48 +0530 Subject: [PATCH] [IMPROVE] Decouples Demo Mode from RC4Git --- client/package-lock.json | 50 --- client/package.json | 4 +- client/src/components/Home/index.css | 182 ----------- client/src/components/Home/index.js | 443 ++++----------------------- client/src/locate/en/translate.json | 34 +- 5 files changed, 69 insertions(+), 644 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 60247f4..4871c7f 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -3739,11 +3739,6 @@ } } }, - "classnames": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", - "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" - }, "clean-css": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", @@ -5129,11 +5124,6 @@ } } }, - "enquire.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz", - "integrity": "sha1-PoeAybi4NQhMP2DhZtvDwqPImBQ=" - }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -8867,14 +8857,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json2mq": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz", - "integrity": "sha1-tje9O6nqvhIsg+lyBIOusQ0skEo=", - "requires": { - "string-convert": "^0.2.0" - } - }, "json3": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz", @@ -9123,11 +9105,6 @@ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -12075,18 +12052,6 @@ "workbox-webpack-plugin": "5.1.4" } }, - "react-slick": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/react-slick/-/react-slick-0.28.1.tgz", - "integrity": "sha512-JwRQXoWGJRbUTE7eZI1rGIHaXX/4YuwX6gn7ulfvUZ4vFDVQAA25HcsHSYaUiRCduTr6rskyIuyPMpuG6bbluw==", - "requires": { - "classnames": "^2.2.5", - "enquire.js": "^2.1.6", - "json2mq": "^0.2.0", - "lodash.debounce": "^4.0.8", - "resize-observer-polyfill": "^1.5.0" - } - }, "react-syntax-highlighter": { "version": "15.4.3", "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.4.3.tgz", @@ -12452,11 +12417,6 @@ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" }, - "resize-observer-polyfill": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", - "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" - }, "resolve": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", @@ -13273,11 +13233,6 @@ "is-fullwidth-code-point": "^3.0.0" } }, - "slick-carousel": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz", - "integrity": "sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA==" - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -13727,11 +13682,6 @@ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, - "string-convert": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", - "integrity": "sha1-aYLMMEn7tM2F+LJFaLnZvznu/5c=" - }, "string-length": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.1.tgz", diff --git a/client/package.json b/client/package.json index 902f046..9a02c91 100644 --- a/client/package.json +++ b/client/package.json @@ -19,9 +19,7 @@ "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.1", - "react-slick": "^0.28.1", - "react-syntax-highlighter": "^15.4.3", - "slick-carousel": "^1.8.1" + "react-syntax-highlighter": "^15.4.3" }, "scripts": { "start": "PORT=3002 react-scripts start", diff --git a/client/src/components/Home/index.css b/client/src/components/Home/index.css index d7ae6be..bb9a442 100644 --- a/client/src/components/Home/index.css +++ b/client/src/components/Home/index.css @@ -145,185 +145,3 @@ height: 1.7em; margin-right: 5px; } - -.select-role-button { - display: flex; - align-items: center; - flex-direction: column; - justify-content: center; - border-radius: 50%; - height: 150px; - width: 150px; - border: 5px solid #ee4a5b; -} - -.select-role-button:hover { - border: 5px solid #2f343d; - cursor: pointer; -} - -.carousel-item-wrapper { - margin: 20px; - text-align: center; -} - -.slick-prev { - width: 30px; - height: 30px; - z-index: 1; -} -.slick-next { - width: 30px; - height: 30px; - z-index: 1; -} - -.carousel-slider { - margin: 40px 20px 60px 20px; -} - -.carousel-item-link { - text-decoration: none; - color: #000000; -} - -.carousel-item-image { - width: 100%; - height: 100%; -} - -.carousel-item-description { - color: hsl(240, 5%, 36%); -} - -.demo-mode-toggle { - display: flex; - flex-direction: row; - align-items: center; - justify-content: flex-end; -} - -.unsigned-search-wrapper { - display: flex; - flex-direction: row; - width: 100%; - justify-content: center; - margin-bottom: 20px; -} - -.unsigned-search-input { - width: 50%; -} - -.stats-heading { - text-align: center; - margin-top: 100px; - margin-bottom: 40px; - color: hsl(240, 6%, 17%); - font-weight: 200; -} - -.featured-content-heading { - text-align: center; - margin-bottom: 40px; - color: hsl(240, 6%, 17%); - font-weight: 200; -} - -.select-role-heading { - text-align: center; - margin-top: 30px; - margin-bottom: 60px; - color: hsl(240, 6%, 17%); - font-weight: 200; -} - -.select-role-buttons-row { - display: flex; - flex-direction: row; - justify-content: space-evenly; - margin-bottom: 100px; -} - -.select-role-button-icon { - height: 50px; - width: 50px; - margin-bottom: 20px; -} - -.communities-wrapper { - margin-bottom: 60px; - margin-top: 30px; -} - -.community-activity-wrapper { - display: flex; - flex-direction: row; -} - -.community-activity-content { - display: flex; - flex-direction: row; - align-items: center; - width: 80%; -} - -.community-activity-author-image { - border-radius: 50%; - height: 40px; - width: 40px; - margin-right: 20px; -} - -.community-activity-heading { - margin-right: 40px; -} - -.community-activity-info { - color: hsl(240, 5%, 36%); -} - -.community-activity-actions-wrapper { - display: flex; - flex-direction: row; - width: 20%; -} - -.community-activity-action { - display: flex; - width: 50%; - align-items: center; -} - -.community-activity-action-button { - height: 25px; - width: 25px; - margin-right: 15px; - margin-left: 30px; -} - -.community-activity-action-button:hover { - cursor: pointer; -} - -.main-stats-container-demo { - width: 100%; - margin-bottom: 20px; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-around; - flex-wrap: wrap; -} - -.button-container-demo { - display: flex; - justify-content: center; - align-items: center; - margin-top: 10px; - margin-bottom: 20px; -} - -.header-link { - color: hsl(240, 5%, 36%); -} diff --git a/client/src/components/Home/index.js b/client/src/components/Home/index.js index 62bc197..38526a7 100644 --- a/client/src/components/Home/index.js +++ b/client/src/components/Home/index.js @@ -1,138 +1,15 @@ -import React, { useState } from "react"; -import { - Button, - TextField, - Select, - MenuItem, - InputAdornment, -} from "@material-ui/core"; -import Slider from "react-slick"; -import { BsSearch } from "react-icons/bs"; -import { FiThumbsUp } from "react-icons/fi"; -import { FaRegComment, FaLaptopCode, FaRegSun } from "react-icons/fa"; -import { RiAdminLine } from "react-icons/ri"; -import { BsChatDots } from "react-icons/bs"; +import React from "react"; +import { Button } from "@material-ui/core"; import Countup from "./../common/Countup"; -import { rcApiDomain } from "../../utils/constants"; -import RCSwitch from "../RCSwitch"; import { Trans, useTranslation } from "react-i18next"; -import "slick-carousel/slick/slick.css"; -import "slick-carousel/slick/slick-theme.css"; import "./index.css"; export default function Home(props) { const { users, onlineUsers, totalMessages } = props.stats; - const [searchCategory, setSearchCategory] = useState(""); - const [demoMode, setDemoMode] = useState(false); const { t, i18n } = useTranslation(); - const carouselItems = [ - { - name: "Data protection solutions", - description: "5 security features that every company should keep in mind", - imageUrl: - "https://528977-1685022-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2021/03/Cover-Image-Blog-11.jpg.webp", - url: - "https://rocket.chat/blog/learn/data-protection-solutions-security-features/", - }, - { - name: "Rocket.Chat raises $19m", - description: - "In Series A funding confirming privacy-first communication as a major trend in 2021", - imageUrl: - "https://528977-1685022-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2021/02/new_header.jpg.webp", - url: - "https://rocket.chat/blog/company/rocket-chat-raises-19-million-in-series-a-funding-confirming-privacy-first-communication-as-a-major-trend-in-2021/", - }, - { - name: "4 Different Slack Alternatives", - description: - "We’ve Tried 4 Different Slack Alternatives & Here’s Our Conclusion", - imageUrl: - "https://528977-1685022-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2020/12/Frame-9.png.webp", - url: "https://rocket.chat/blog/learn/slack-alternative/", - }, - { - name: "Is WhatsApp safe for companies?", - description: "A quick guide for secure messaging", - imageUrl: - "https://528977-1685022-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2021/01/whatsapp-safe-secure-messaging-blog.jpg", - url: "https://rocket.chat/blog/learn/whatsapp-guide-secure-messaging/", - }, - { - name: "Security Bundle", - description: - "Get to Know Rocket.Chat’s Newest Weapon For Secure Messaging", - imageUrl: - "https://528977-1685022-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2021/02/Security-Bundle-Ilustra.jpg.webp", - url: - "https://rocket.chat/blog/product/security-bundle-for-secure-messaging/", - }, - ]; - - const activityItems = [ - { - title: - "I am setting up live chat and want to send an attachment ...how do I do that?", - author: "LigayaFernandez", - role: "LiveChat User", - community: "Question Forum", - time: "17 min ago", - upvotes: 0, - comments: 1, - }, - { - title: "Stranger Introduction", - author: "Izzie ", - role: "GSoC Student", - community: "GSoC 2021", - time: "1 hour ago", - upvotes: 5, - comments: 10, - }, - { - title: "Setting Up Rocket Chat", - author: "arary", - role: "Developer", - community: "Developer Discussions", - time: "2 hours ago", - upvotes: 0, - comments: 1, - }, - { - title: "RC4Community Improvements", - author: "aumurad", - role: "Admin", - community: "Announcements", - time: "4 hours ago", - upvotes: 50, - comments: 3, - }, - ]; - - const Item = (props) => { - return ( -
- - -

{props.item.name}

-
-

{props.item.description}

-
- ); - }; - - const handleChange = (event) => { - setSearchCategory(event.target.value); - }; - const getGreetings = () => { let d = new Date(); let time = d.getHours(); @@ -149,267 +26,71 @@ export default function Home(props) { if (!props.authState.isLoggedIn) { return (
-
-

{t("Demo_Mode")}

- setDemoMode(!demoMode)} - name="demoMode" - /> -
- - {!demoMode ? ( - <> -
-

- {t("unsigned-home.heading")} -
- - {t("unsigned-home.subheading")} - -

- -

- - Monitor your workflows, - collaborate and access data{" "} - any time you need it, all in one{" "} - productivity-amplifying full-lifecycle - platform - -

-
-
-
-
- users - -
- {t("unsigned-home.users-stats-label")} -
-
-
- messages - -
- {t("unsigned-home.messages-exchanged-stats-label")} -
-
-
- online-users - -
- {t("unsigned-home.online-users-stats-label")} -
-
-
-
- -
-
- - ) : ( - <> -
-

- {t("unsigned-home-demo.heading")} -
-

- -

- - Monitor your workflows, - collaborate and access data{" "} - any time you need it, all in one{" "} - productivity-amplifying full-lifecycle - platform - -

-
- -

- - {t("unsigned-home-demo.user-guides")} - - |{" "} - - {t("unsigned-home-demo.release-notes")} - -

-
- - - - - - ), - }} - /> -
- -
-
- users - -
- {t("unsigned-home-demo.users-stats-label")} -
-
-
- messages - - -
- {t("unsigned-home-demo.messages-exchanged-stats-label")} -
-
-
- online-users - -
- {t("unsigned-home-demo.online-users-stats-label")} -
-
-
- -
- -
-
-

- {t("unsigned-home-demo.blogs-heading")} -

- } - nextArrow={} +
+

+ {t("unsigned-home.heading")} +
+ - {carouselItems.map((item, i) => ( - - ))} - -

- {t("unsigned-home-demo.select-role-heading")} -

-

+ +

+ + Monitor your workflows, + collaborate and access data any + time you need it, all in one{" "} + productivity-amplifying full-lifecycle platform + +

+
+
+
+
+ users + +
+ {t("unsigned-home.users-stats-label")}
-
- - {t("unsigned-home-demo.gsoc-student-role")} +
+
+ messages + +
+ {t("unsigned-home.messages-exchanged-stats-label")}
-
-

{t("unsigned-home-demo.community-activity-heading")}

- {activityItems.map((item) => ( -
-
- -
-

{item.title}

-

- by{" "} - - {item.author}({item.role}) - {" "} - in {item.community} {item.time}{" "} -

-
-
-
-
- - {item.upvotes} -
-
- - {item.comments} -
-
-
- ))} +
+ online-users + +
+ {t("unsigned-home.online-users-stats-label")} +
- - )} +
+
+ +
+
); } diff --git a/client/src/locate/en/translate.json b/client/src/locate/en/translate.json index fa05aa9..3c8cd6b 100644 --- a/client/src/locate/en/translate.json +++ b/client/src/locate/en/translate.json @@ -1,6 +1,5 @@ { "translations": { - "Demo_Mode": "Demo Mode", "unsigned-home": { "heading": "Real-time Collaboration", "subheading": "Powered by Communities", @@ -10,33 +9,12 @@ "online-users-stats-label": "Online Users", "join-button": "JOIN NOW TO EXPLORE MORE" }, - "unsigned-home-demo": { - "heading": "Welcome to our community", - "description": "Let's dream, share, and collaborate in shaping the future of the Rocket.Chat ecosystem together" , - "menu-item-1": "All Communities", - "menu-item-2": "Rooms", - "menu-item-3": "Users", - "menu-item-4": "Messages", - "join-button": "JOIN NOW!", - "users-stats-label": "Users", - "messages-exchanged-stats-label": "Messages Exchanged", - "online-users-stats-label": "Online Users", - "blogs-heading": "Latest Community News", - "select-role-heading": "Get what you need ...", - "admin-role": "Admin", - "developer-role": "Developer", - "live-chat-user-role": "Live Chat User", - "gsoc-student-role": "GSoC Student", - "community-activity-heading": "Community Activity", - "user-guides": "Read the Guides", - "release-notes": "Read Release Notes" - }, "signed-home": { - "heading": "We're ready to go.", - "start-heading": "Start something new", - "create-room": "Create a room", - "explore-heading": "Explore more", - "discover-rooms": "Discover existing rooms" + "heading": "We're ready to go.", + "start-heading": "Start something new", + "create-room": "Create a room", + "explore-heading": "Explore more", + "discover-rooms": "Discover existing rooms" } - } + } }