From 9c1520a0169a60fafb8d8c698e69bb041faea8ae Mon Sep 17 00:00:00 2001 From: nishant23122000 Date: Thu, 10 Feb 2022 14:54:10 +0530 Subject: [PATCH 1/5] refactor --- app/components/discourserankedlist.js | 77 +------------- app/components/growthcounters.js | 34 +++--- app/components/infotiles.js | 37 ++----- app/components/newscarousel.js | 10 +- app/components/personalcircle.js | 146 ++------------------------ app/data/DiscourserankedlistData.js | 76 ++++++++++++++ app/data/growthcountersData.js | 18 ++++ app/data/infotilesData.js | 20 ++++ app/data/persionalCircleData.js | 136 ++++++++++++++++++++++++ app/styles/Infotiles.module.css | 6 ++ app/styles/Newscarousel.module.css | 8 ++ 11 files changed, 308 insertions(+), 260 deletions(-) create mode 100644 app/data/DiscourserankedlistData.js create mode 100644 app/data/growthcountersData.js create mode 100644 app/data/infotilesData.js create mode 100644 app/data/persionalCircleData.js diff --git a/app/components/discourserankedlist.js b/app/components/discourserankedlist.js index dfc996fb..8b5d6cc2 100644 --- a/app/components/discourserankedlist.js +++ b/app/components/discourserankedlist.js @@ -2,7 +2,7 @@ import { Col, Row } from 'react-bootstrap'; import styles from '../styles/Discourserankedlist.module.css'; import Like from '../public/svg/like.js'; import Comment from '../public/svg/comment'; - +import Data from '../data/DiscourserankedlistData'; function TimeSince(date) { let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; @@ -29,80 +29,7 @@ function TimeSince(date) { } function Discourserankedlist(props) { - const Data = [ - { - id: 1, - title: - 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', - time: '6:57 PM', - upvotes: '89', - comments: '91', - }, - { - id: 2, - title: 'Why can’t we have thumbnails for video uploads on mobile?', - time: '4:00 PM', - upvotes: '500', - comments: '4', - }, - { - id: 3, - title: 'Can’t find “Users must use Two Factor Authentication” Option', - time: '12:53 PM', - upvotes: '456', - comments: '75', - }, - { - id: 4, - title: 'Can’t “forget/remove my data” directly in RC 4.3.0 in livechat', - time: '8:36 AM', - upvotes: '234', - comments: '199', - }, - { - id: 5, - title: 'Not migrating, control is locked', - time: '11:30 PM', - upvotes: '441', - comments: '74', - }, - { - id: 6, - title: - 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', - time: '7:14 PM', - upvotes: '972', - comments: '42', - }, - { - id: 7, - title: 'Can’t find “Users must use Two Factor Authentication” Option', - time: '3:36 PM', - upvotes: '4279', - comments: '98', - }, - { - id: 8, - title: 'Cannot Chat Log Level - Option has disappeared', - time: '11:06 AM', - upvotes: '51', - comments: '291', - }, - { - id: 9, - title: 'Wrong IP Server', - time: '2:00 PM', - upvotes: '478', - comments: '25', - }, - { - id: 10, - title: 'Not migrating, control is locked', - time: '11:03 PM', - upvotes: '16', - comments: '15', - }, - ]; + //generates random colour for border styling const color = [ 'border-primary', diff --git a/app/components/growthcounters.js b/app/components/growthcounters.js index 007236b6..cb0ae981 100644 --- a/app/components/growthcounters.js +++ b/app/components/growthcounters.js @@ -1,37 +1,27 @@ import styles from '../styles/Growthcounters.module.css'; import Countup from './clientsideonly/countup'; - +import content from '../data/growthcountersData'; export default function Growthcounters() { + + return ( <>
-
+ { + content.map((comp)=>{ + return ( +
{process.browser && ( - + )} - Users -
- -
- - {process.browser && ( - - )} - - Messages -
- -
- - {process.browser && ( - - )} - - Online + {comp.title}
+ ) + }) + }
); diff --git a/app/components/infotiles.js b/app/components/infotiles.js index 02221316..f35a46af 100644 --- a/app/components/infotiles.js +++ b/app/components/infotiles.js @@ -1,34 +1,17 @@ -import Styles from '../styles/Infotiles.module.css'; - +import Styles from "../styles/Infotiles.module.css"; +import infotiles from "../data/infotilesData"; export default function Infotiles() { return ( <>
-
-
Documentation
-

- Find in-depth information about Rocket.Chat features and API. -

-
-
-
Learn
-

- Learn about Rocket.Chat in an interactive course with quizzes! -

-
-
-
Examples
-

- Discover and deploy boilerplate example Rocket.Chat projects. -

-
-
-
Deploy
-

- Instantly deploy your Rocket.Chat site to a public URL with - Rocket.Chat SaaS. -

-
+ {infotiles.map((info) => { + return ( +
+
{info.title}
+

{info.body}

+
+ ); + })}
); diff --git a/app/components/newscarousel.js b/app/components/newscarousel.js index 1bef8341..dcafc1fa 100644 --- a/app/components/newscarousel.js +++ b/app/components/newscarousel.js @@ -48,13 +48,21 @@ function Newscarousel(props) { }, }, { - breakpoint: 600, + breakpoint: 800, settings: { slidesToShow: 2, slidesToScroll: 2, initialSlide: 2, }, }, + { + breakpoint: 600, + settings: { + slidesToShow: 1, + slidesToScroll: 2, + initialSlide: 2, + }, + }, ]} prevArrow={ - -
- - - - - -
-
Admin
-
- -
- - - - - - -
-
Developer
-
- -
- - - - - - -
-
Group Chat
-
- -
- - - - - - - - -
-
GSoC
-
+ {personalCircles.map((personal) => { + return ( + +
{personal.svg}
+
{personal.title}
+
+ ); + })} ); diff --git a/app/data/DiscourserankedlistData.js b/app/data/DiscourserankedlistData.js new file mode 100644 index 00000000..3ce13f2d --- /dev/null +++ b/app/data/DiscourserankedlistData.js @@ -0,0 +1,76 @@ +const DiscourserankedlistData = [ + { + id: 1, + title: + 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', + time: '6:57 PM', + upvotes: '89', + comments: '91', + }, + { + id: 2, + title: 'Why can’t we have thumbnails for video uploads on mobile?', + time: '4:00 PM', + upvotes: '500', + comments: '4', + }, + { + id: 3, + title: 'Can’t find “Users must use Two Factor Authentication” Option', + time: '12:53 PM', + upvotes: '456', + comments: '75', + }, + { + id: 4, + title: 'Can’t “forget/remove my data” directly in RC 4.3.0 in livechat', + time: '8:36 AM', + upvotes: '234', + comments: '199', + }, + { + id: 5, + title: 'Not migrating, control is locked', + time: '11:30 PM', + upvotes: '441', + comments: '74', + }, + { + id: 6, + title: + 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', + time: '7:14 PM', + upvotes: '972', + comments: '42', + }, + { + id: 7, + title: 'Can’t find “Users must use Two Factor Authentication” Option', + time: '3:36 PM', + upvotes: '4279', + comments: '98', + }, + { + id: 8, + title: 'Cannot Chat Log Level - Option has disappeared', + time: '11:06 AM', + upvotes: '51', + comments: '291', + }, + { + id: 9, + title: 'Wrong IP Server', + time: '2:00 PM', + upvotes: '478', + comments: '25', + }, + { + id: 10, + title: 'Not migrating, control is locked', + time: '11:03 PM', + upvotes: '16', + comments: '15', + }, + ]; + + export default DiscourserankedlistData; \ No newline at end of file diff --git a/app/data/growthcountersData.js b/app/data/growthcountersData.js new file mode 100644 index 00000000..6327cb4e --- /dev/null +++ b/app/data/growthcountersData.js @@ -0,0 +1,18 @@ + + const growthcountersData=[ + { + class:'d-flex flex-column pe-4 px-md-5 mx-md-3', + end:'343433', + title:'Users', + },{ + class:'d-flex flex-column px-4 px-md-5 mx-md-3 border-start border-gray', + end:'1294056', + title:'Messages', + },{ + class:'d-flex flex-column ps-4 px-md-5 mx-md-3 border-start border-gray', + end:'507', + title:'Online', + }, + ] + + export default growthcountersData; \ No newline at end of file diff --git a/app/data/infotilesData.js b/app/data/infotilesData.js new file mode 100644 index 00000000..0ffbecc0 --- /dev/null +++ b/app/data/infotilesData.js @@ -0,0 +1,20 @@ + + + +const infotilesData=[ + { + title:'Documentation', + body:'Find in-depth information about Rocket.Chat features and API.' + },{ + title:'Learn', + body:'Learn about Rocket.Chat in an interactive course with quizzes!' + },{ + title:'Examples', + body:'Discover and deploy boilerplate example Rocket.Chat projects.' + },{ + title:'Deploy', + body:'Instantly deploy your Rocket.Chat site to a public URL with Rocket.Chat SaaS.' + } +] + +export default infotilesData; \ No newline at end of file diff --git a/app/data/persionalCircleData.js b/app/data/persionalCircleData.js new file mode 100644 index 00000000..6396f322 --- /dev/null +++ b/app/data/persionalCircleData.js @@ -0,0 +1,136 @@ +const persionalCircleData = [ + { + svg: ( + + + + + + ), + title: "Admin", + }, + { + svg: ( + + + + + + + ), + title: "Developer", + }, + { + svg: ( + + + + + + + ), + title: "Group Chat", + }, + { + svg: ( + + + + + + + + + ), + title: "GSoC", + }, +]; + +export default persionalCircleData; diff --git a/app/styles/Infotiles.module.css b/app/styles/Infotiles.module.css index 569348cb..47bb1594 100644 --- a/app/styles/Infotiles.module.css +++ b/app/styles/Infotiles.module.css @@ -30,3 +30,9 @@ background: #1d74f5; color: white; } + +@media (max-width: 600px) { + .card { + width: 100%; + } +} diff --git a/app/styles/Newscarousel.module.css b/app/styles/Newscarousel.module.css index 3ce5ad8d..b9c22b86 100644 --- a/app/styles/Newscarousel.module.css +++ b/app/styles/Newscarousel.module.css @@ -26,3 +26,11 @@ .carousel-item-title { font-size: 22.5px; } +@media (max-width: 600px) { + .heading { + font-size: clamp(1.3rem, 1.7vw, 1.2rem); + } + .description { + font-size: clamp(0.8rem, 1.2vw, 0.8rem); + } +} From ca58c55ffa123578f47fdf715b802649533d9442 Mon Sep 17 00:00:00 2001 From: nkpatel23122000 Date: Thu, 17 Feb 2022 12:41:37 +0530 Subject: [PATCH 2/5] fetch from strapi --- app/components/discourserankedlist.js | 6 +- app/components/growthcounters.js | 40 +++--- app/components/infotiles.js | 5 +- .../{personalcircle.js => personcircle.js} | 12 +- app/data/DiscourserankedlistData.js | 76 ---------- app/data/growthcountersData.js | 18 --- app/data/infotilesData.js | 20 --- app/data/persionalCircleData.js | 136 ------------------ app/lib/github.js | 1 - app/pages/index.js | 19 +-- cms/api/community-activity/config/routes.json | 52 +++++++ .../controllers/community-activity.js} | 0 .../models/community-activity.js} | 0 .../models/community-activity.settings.json | 28 ++++ .../services/community-activity.js} | 0 .../{persona => counter}/config/routes.json | 24 ++-- .../controllers/counter.js} | 0 .../models/counter.js} | 0 .../models/counter.settings.json} | 12 +- .../services/counter.js} | 0 .../discourse/models/discourse.settings.json | 21 --- .../config/routes.json | 24 ++-- .../controllers/infotile.js} | 0 .../models/infotile.js} | 0 .../models/infotile.settings.json} | 13 +- .../services/infotile.js} | 0 .../config/routes.json | 24 ++-- cms/api/persons/controllers/persons.js | 8 ++ cms/api/persons/models/persons.js | 8 ++ cms/api/persons/models/persons.settings.json | 30 ++++ cms/api/persons/services/persons.js | 8 ++ 31 files changed, 225 insertions(+), 360 deletions(-) rename app/components/{personalcircle.js => personcircle.js} (54%) delete mode 100644 app/data/DiscourserankedlistData.js delete mode 100644 app/data/growthcountersData.js delete mode 100644 app/data/infotilesData.js delete mode 100644 app/data/persionalCircleData.js create mode 100644 cms/api/community-activity/config/routes.json rename cms/api/{discourse/controllers/discourse.js => community-activity/controllers/community-activity.js} (100%) rename cms/api/{discourse/models/discourse.js => community-activity/models/community-activity.js} (100%) create mode 100644 cms/api/community-activity/models/community-activity.settings.json rename cms/api/{discourse/services/discourse.js => community-activity/services/community-activity.js} (100%) rename cms/api/{persona => counter}/config/routes.json (57%) rename cms/api/{persona-icons/controllers/persona-icons.js => counter/controllers/counter.js} (100%) rename cms/api/{persona-icons/models/persona-icons.js => counter/models/counter.js} (100%) rename cms/api/{persona/models/persona.settings.json => counter/models/counter.settings.json} (67%) rename cms/api/{persona-icons/services/persona-icons.js => counter/services/counter.js} (100%) delete mode 100644 cms/api/discourse/models/discourse.settings.json rename cms/api/{discourse => infotile}/config/routes.json (56%) rename cms/api/{persona/controllers/persona.js => infotile/controllers/infotile.js} (100%) rename cms/api/{persona/models/persona.js => infotile/models/infotile.js} (100%) rename cms/api/{persona-icons/models/persona-icons.settings.json => infotile/models/infotile.settings.json} (58%) rename cms/api/{persona/services/persona.js => infotile/services/infotile.js} (100%) rename cms/api/{persona-icons => persons}/config/routes.json (54%) create mode 100644 cms/api/persons/controllers/persons.js create mode 100644 cms/api/persons/models/persons.js create mode 100644 cms/api/persons/models/persons.settings.json create mode 100644 cms/api/persons/services/persons.js diff --git a/app/components/discourserankedlist.js b/app/components/discourserankedlist.js index 8b5d6cc2..afe8b596 100644 --- a/app/components/discourserankedlist.js +++ b/app/components/discourserankedlist.js @@ -2,7 +2,7 @@ import { Col, Row } from 'react-bootstrap'; import styles from '../styles/Discourserankedlist.module.css'; import Like from '../public/svg/like.js'; import Comment from '../public/svg/comment'; -import Data from '../data/DiscourserankedlistData'; + function TimeSince(date) { let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; @@ -28,7 +28,7 @@ function TimeSince(date) { return Math.floor(seconds) + ' seconds ago'; } -function Discourserankedlist(props) { +function Discourserankedlist({activities}) { //generates random colour for border styling const color = [ @@ -57,7 +57,7 @@ function Discourserankedlist(props) { - {Data.map(item => ( + {activities.map(item => ( -
- { - content.map((comp)=>{ - return ( -
- - {process.browser && ( - - )} - +
+ {counters.map((count, index) => { + return ( +
+ + {process.browser && ( + + )} + - {comp.title} -
- ) - }) - } + {count.title} +
+ ); + })}
); diff --git a/app/components/infotiles.js b/app/components/infotiles.js index f35a46af..cf5f5196 100644 --- a/app/components/infotiles.js +++ b/app/components/infotiles.js @@ -1,6 +1,5 @@ import Styles from "../styles/Infotiles.module.css"; -import infotiles from "../data/infotilesData"; -export default function Infotiles() { +export default function Infotiles({infotiles}) { return ( <>
@@ -8,7 +7,7 @@ export default function Infotiles() { return (
{info.title}
-

{info.body}

+

{info.description}

); })} diff --git a/app/components/personalcircle.js b/app/components/personcircle.js similarity index 54% rename from app/components/personalcircle.js rename to app/components/personcircle.js index ac306049..614c7a9c 100644 --- a/app/components/personalcircle.js +++ b/app/components/personcircle.js @@ -1,17 +1,19 @@ import { Button, ButtonGroup, Col } from "react-bootstrap"; import styles from "../styles/Personacircle.module.css"; -import personalCircles from "../data/persionalCircleData"; -export default function Personacircle(props) { +import {getStrapiURL } from '../lib/api'; +export default function Personcircle({persons}) { return ( <> - {personalCircles.map((personal) => { + {persons.map((person) => { return ( -
{personal.svg}
-
{personal.title}
+
+ +
+
{person.title}
); })} diff --git a/app/data/DiscourserankedlistData.js b/app/data/DiscourserankedlistData.js deleted file mode 100644 index 3ce13f2d..00000000 --- a/app/data/DiscourserankedlistData.js +++ /dev/null @@ -1,76 +0,0 @@ -const DiscourserankedlistData = [ - { - id: 1, - title: - 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', - time: '6:57 PM', - upvotes: '89', - comments: '91', - }, - { - id: 2, - title: 'Why can’t we have thumbnails for video uploads on mobile?', - time: '4:00 PM', - upvotes: '500', - comments: '4', - }, - { - id: 3, - title: 'Can’t find “Users must use Two Factor Authentication” Option', - time: '12:53 PM', - upvotes: '456', - comments: '75', - }, - { - id: 4, - title: 'Can’t “forget/remove my data” directly in RC 4.3.0 in livechat', - time: '8:36 AM', - upvotes: '234', - comments: '199', - }, - { - id: 5, - title: 'Not migrating, control is locked', - time: '11:30 PM', - upvotes: '441', - comments: '74', - }, - { - id: 6, - title: - 'Upload stuck at 0% again after initially fixing with chanding site url in General admin options', - time: '7:14 PM', - upvotes: '972', - comments: '42', - }, - { - id: 7, - title: 'Can’t find “Users must use Two Factor Authentication” Option', - time: '3:36 PM', - upvotes: '4279', - comments: '98', - }, - { - id: 8, - title: 'Cannot Chat Log Level - Option has disappeared', - time: '11:06 AM', - upvotes: '51', - comments: '291', - }, - { - id: 9, - title: 'Wrong IP Server', - time: '2:00 PM', - upvotes: '478', - comments: '25', - }, - { - id: 10, - title: 'Not migrating, control is locked', - time: '11:03 PM', - upvotes: '16', - comments: '15', - }, - ]; - - export default DiscourserankedlistData; \ No newline at end of file diff --git a/app/data/growthcountersData.js b/app/data/growthcountersData.js deleted file mode 100644 index 6327cb4e..00000000 --- a/app/data/growthcountersData.js +++ /dev/null @@ -1,18 +0,0 @@ - - const growthcountersData=[ - { - class:'d-flex flex-column pe-4 px-md-5 mx-md-3', - end:'343433', - title:'Users', - },{ - class:'d-flex flex-column px-4 px-md-5 mx-md-3 border-start border-gray', - end:'1294056', - title:'Messages', - },{ - class:'d-flex flex-column ps-4 px-md-5 mx-md-3 border-start border-gray', - end:'507', - title:'Online', - }, - ] - - export default growthcountersData; \ No newline at end of file diff --git a/app/data/infotilesData.js b/app/data/infotilesData.js deleted file mode 100644 index 0ffbecc0..00000000 --- a/app/data/infotilesData.js +++ /dev/null @@ -1,20 +0,0 @@ - - - -const infotilesData=[ - { - title:'Documentation', - body:'Find in-depth information about Rocket.Chat features and API.' - },{ - title:'Learn', - body:'Learn about Rocket.Chat in an interactive course with quizzes!' - },{ - title:'Examples', - body:'Discover and deploy boilerplate example Rocket.Chat projects.' - },{ - title:'Deploy', - body:'Instantly deploy your Rocket.Chat site to a public URL with Rocket.Chat SaaS.' - } -] - -export default infotilesData; \ No newline at end of file diff --git a/app/data/persionalCircleData.js b/app/data/persionalCircleData.js deleted file mode 100644 index 6396f322..00000000 --- a/app/data/persionalCircleData.js +++ /dev/null @@ -1,136 +0,0 @@ -const persionalCircleData = [ - { - svg: ( - - - - - - ), - title: "Admin", - }, - { - svg: ( - - - - - - - ), - title: "Developer", - }, - { - svg: ( - - - - - - - ), - title: "Group Chat", - }, - { - svg: ( - - - - - - - - - ), - title: "GSoC", - }, -]; - -export default persionalCircleData; diff --git a/app/lib/github.js b/app/lib/github.js index dd7d1836..38aa12bc 100644 --- a/app/lib/github.js +++ b/app/lib/github.js @@ -15,7 +15,6 @@ export const getIssues = async (owner, repo) => { }, ]; const res = await fetchAPI('/ghissues'); - console.log(res); if (Array.isArray(res) && Array.isArray(res[0].Issues)) { issues = res[0].Issues; } diff --git a/app/pages/index.js b/app/pages/index.js index 618dfa7b..eab53c4a 100644 --- a/app/pages/index.js +++ b/app/pages/index.js @@ -2,7 +2,7 @@ import Head from 'next/head'; import styles from '../styles/Home.module.css'; import Infotiles from '../components/infotiles'; import Newscarousel from '../components/newscarousel'; -import Personacircle from '../components/personalcircle'; +import Personacircle from '../components/personcircle'; import Discourserankedlist from '../components/discourserankedlist'; import Searchbox from '../components/searchbox'; import Growthcounters from '../components/growthcounters'; @@ -43,10 +43,10 @@ function Home(props) { - + - +
Get What You Need... - +

Community Activity

- +
@@ -91,16 +91,19 @@ export default withFirebaseAuthUser()(Home); export async function getStaticProps({ params }) { const carousels = await fetchAPI('/carousels'); - const personas = await fetchAPI('/personas'); + const persons = await fetchAPI('/persons'); const guides = await fetchAPI('/guides'); const releaseNotes = await fetchAPI('/release-notes'); + const infotiles=await fetchAPI('/infotiles'); + const counters=await fetchAPI('/counters'); + const communityActivities=await fetchAPI('/community-activities'); const topNavItems = await fetchAPI('/top-nav-item'); - const topPosts = await fetchAPI('/discourses'); const issues = await getIssues('RocketChat', 'RC4Community'); const contributors = await getContributors(); + return { - props: { carousels, personas, guides, releaseNotes, topNavItems, topPosts, issues, contributors }, + props: { carousels, persons, guides, releaseNotes, topNavItems, issues, contributors,infotiles,counters,communityActivities }, // Next.js will attempt to re-generate the page: // - When a request comes in // - At most once every 1 second diff --git a/cms/api/community-activity/config/routes.json b/cms/api/community-activity/config/routes.json new file mode 100644 index 00000000..7babc65f --- /dev/null +++ b/cms/api/community-activity/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/community-activities", + "handler": "community-activity.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/community-activities/count", + "handler": "community-activity.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/community-activities/:id", + "handler": "community-activity.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/community-activities", + "handler": "community-activity.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/community-activities/:id", + "handler": "community-activity.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/community-activities/:id", + "handler": "community-activity.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/cms/api/discourse/controllers/discourse.js b/cms/api/community-activity/controllers/community-activity.js similarity index 100% rename from cms/api/discourse/controllers/discourse.js rename to cms/api/community-activity/controllers/community-activity.js diff --git a/cms/api/discourse/models/discourse.js b/cms/api/community-activity/models/community-activity.js similarity index 100% rename from cms/api/discourse/models/discourse.js rename to cms/api/community-activity/models/community-activity.js diff --git a/cms/api/community-activity/models/community-activity.settings.json b/cms/api/community-activity/models/community-activity.settings.json new file mode 100644 index 00000000..70fecfe3 --- /dev/null +++ b/cms/api/community-activity/models/community-activity.settings.json @@ -0,0 +1,28 @@ +{ + "kind": "collectionType", + "collectionName": "community_activities", + "info": { + "name": "CommunityActivity", + "description": "" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "text" + }, + "time": { + "type": "string" + }, + "upvotes": { + "type": "integer" + }, + "comments": { + "type": "integer" + } + } +} diff --git a/cms/api/discourse/services/discourse.js b/cms/api/community-activity/services/community-activity.js similarity index 100% rename from cms/api/discourse/services/discourse.js rename to cms/api/community-activity/services/community-activity.js diff --git a/cms/api/persona/config/routes.json b/cms/api/counter/config/routes.json similarity index 57% rename from cms/api/persona/config/routes.json rename to cms/api/counter/config/routes.json index 092f1fe5..b428f153 100644 --- a/cms/api/persona/config/routes.json +++ b/cms/api/counter/config/routes.json @@ -2,48 +2,48 @@ "routes": [ { "method": "GET", - "path": "/personas", - "handler": "persona.find", + "path": "/counters", + "handler": "counter.find", "config": { "policies": [] } }, { "method": "GET", - "path": "/personas/count", - "handler": "persona.count", + "path": "/counters/count", + "handler": "counter.count", "config": { "policies": [] } }, { "method": "GET", - "path": "/personas/:id", - "handler": "persona.findOne", + "path": "/counters/:id", + "handler": "counter.findOne", "config": { "policies": [] } }, { "method": "POST", - "path": "/personas", - "handler": "persona.create", + "path": "/counters", + "handler": "counter.create", "config": { "policies": [] } }, { "method": "PUT", - "path": "/personas/:id", - "handler": "persona.update", + "path": "/counters/:id", + "handler": "counter.update", "config": { "policies": [] } }, { "method": "DELETE", - "path": "/personas/:id", - "handler": "persona.delete", + "path": "/counters/:id", + "handler": "counter.delete", "config": { "policies": [] } diff --git a/cms/api/persona-icons/controllers/persona-icons.js b/cms/api/counter/controllers/counter.js similarity index 100% rename from cms/api/persona-icons/controllers/persona-icons.js rename to cms/api/counter/controllers/counter.js diff --git a/cms/api/persona-icons/models/persona-icons.js b/cms/api/counter/models/counter.js similarity index 100% rename from cms/api/persona-icons/models/persona-icons.js rename to cms/api/counter/models/counter.js diff --git a/cms/api/persona/models/persona.settings.json b/cms/api/counter/models/counter.settings.json similarity index 67% rename from cms/api/persona/models/persona.settings.json rename to cms/api/counter/models/counter.settings.json index ee510d39..7f640007 100644 --- a/cms/api/persona/models/persona.settings.json +++ b/cms/api/counter/models/counter.settings.json @@ -1,8 +1,8 @@ { "kind": "collectionType", - "collectionName": "personas", + "collectionName": "counters", "info": { - "name": "Persona", + "name": "Counter", "description": "" }, "options": { @@ -12,11 +12,11 @@ }, "pluginOptions": {}, "attributes": { - "name": { - "type": "string" + "count": { + "type": "integer" }, - "persona_icon": { - "model": "persona-icons" + "title": { + "type": "string" } } } diff --git a/cms/api/persona-icons/services/persona-icons.js b/cms/api/counter/services/counter.js similarity index 100% rename from cms/api/persona-icons/services/persona-icons.js rename to cms/api/counter/services/counter.js diff --git a/cms/api/discourse/models/discourse.settings.json b/cms/api/discourse/models/discourse.settings.json deleted file mode 100644 index 0ad4a21e..00000000 --- a/cms/api/discourse/models/discourse.settings.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "kind": "collectionType", - "collectionName": "discourses", - "info": { - "name": "discourse", - "description": "" - }, - "options": { - "increments": true, - "timestamps": true, - "draftAndPublish": true - }, - "pluginOptions": {}, - "attributes": { - "TopPost": { - "type": "json", - "required": true, - "unique": false - } - } -} diff --git a/cms/api/discourse/config/routes.json b/cms/api/infotile/config/routes.json similarity index 56% rename from cms/api/discourse/config/routes.json rename to cms/api/infotile/config/routes.json index c1828d63..dbb746f3 100644 --- a/cms/api/discourse/config/routes.json +++ b/cms/api/infotile/config/routes.json @@ -2,48 +2,48 @@ "routes": [ { "method": "GET", - "path": "/discourses", - "handler": "discourse.find", + "path": "/infotiles", + "handler": "infotile.find", "config": { "policies": [] } }, { "method": "GET", - "path": "/discourses/count", - "handler": "discourse.count", + "path": "/infotiles/count", + "handler": "infotile.count", "config": { "policies": [] } }, { "method": "GET", - "path": "/discourses/:id", - "handler": "discourse.findOne", + "path": "/infotiles/:id", + "handler": "infotile.findOne", "config": { "policies": [] } }, { "method": "POST", - "path": "/discourses", - "handler": "discourse.create", + "path": "/infotiles", + "handler": "infotile.create", "config": { "policies": [] } }, { "method": "PUT", - "path": "/discourses/:id", - "handler": "discourse.update", + "path": "/infotiles/:id", + "handler": "infotile.update", "config": { "policies": [] } }, { "method": "DELETE", - "path": "/discourses/:id", - "handler": "discourse.delete", + "path": "/infotiles/:id", + "handler": "infotile.delete", "config": { "policies": [] } diff --git a/cms/api/persona/controllers/persona.js b/cms/api/infotile/controllers/infotile.js similarity index 100% rename from cms/api/persona/controllers/persona.js rename to cms/api/infotile/controllers/infotile.js diff --git a/cms/api/persona/models/persona.js b/cms/api/infotile/models/infotile.js similarity index 100% rename from cms/api/persona/models/persona.js rename to cms/api/infotile/models/infotile.js diff --git a/cms/api/persona-icons/models/persona-icons.settings.json b/cms/api/infotile/models/infotile.settings.json similarity index 58% rename from cms/api/persona-icons/models/persona-icons.settings.json rename to cms/api/infotile/models/infotile.settings.json index b4fc3576..b00ba8af 100644 --- a/cms/api/persona-icons/models/persona-icons.settings.json +++ b/cms/api/infotile/models/infotile.settings.json @@ -1,8 +1,8 @@ { "kind": "collectionType", - "collectionName": "persona_icons", + "collectionName": "infotiles", "info": { - "name": "PersonaIcons" + "name": "infotile" }, "options": { "increments": true, @@ -11,14 +11,11 @@ }, "pluginOptions": {}, "attributes": { - "icon": { + "title": { "type": "string" }, - "size": { - "type": "integer" - }, - "color": { - "type": "string" + "description": { + "type": "text" } } } diff --git a/cms/api/persona/services/persona.js b/cms/api/infotile/services/infotile.js similarity index 100% rename from cms/api/persona/services/persona.js rename to cms/api/infotile/services/infotile.js diff --git a/cms/api/persona-icons/config/routes.json b/cms/api/persons/config/routes.json similarity index 54% rename from cms/api/persona-icons/config/routes.json rename to cms/api/persons/config/routes.json index 1407e41e..7002d114 100644 --- a/cms/api/persona-icons/config/routes.json +++ b/cms/api/persons/config/routes.json @@ -2,48 +2,48 @@ "routes": [ { "method": "GET", - "path": "/persona-icons", - "handler": "persona-icons.find", + "path": "/persons", + "handler": "persons.find", "config": { "policies": [] } }, { "method": "GET", - "path": "/persona-icons/count", - "handler": "persona-icons.count", + "path": "/persons/count", + "handler": "persons.count", "config": { "policies": [] } }, { "method": "GET", - "path": "/persona-icons/:id", - "handler": "persona-icons.findOne", + "path": "/persons/:id", + "handler": "persons.findOne", "config": { "policies": [] } }, { "method": "POST", - "path": "/persona-icons", - "handler": "persona-icons.create", + "path": "/persons", + "handler": "persons.create", "config": { "policies": [] } }, { "method": "PUT", - "path": "/persona-icons/:id", - "handler": "persona-icons.update", + "path": "/persons/:id", + "handler": "persons.update", "config": { "policies": [] } }, { "method": "DELETE", - "path": "/persona-icons/:id", - "handler": "persona-icons.delete", + "path": "/persons/:id", + "handler": "persons.delete", "config": { "policies": [] } diff --git a/cms/api/persons/controllers/persons.js b/cms/api/persons/controllers/persons.js new file mode 100644 index 00000000..e8608953 --- /dev/null +++ b/cms/api/persons/controllers/persons.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers) + * to customize this controller + */ + +module.exports = {}; diff --git a/cms/api/persons/models/persons.js b/cms/api/persons/models/persons.js new file mode 100644 index 00000000..0054d33c --- /dev/null +++ b/cms/api/persons/models/persons.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) + * to customize this model + */ + +module.exports = {}; diff --git a/cms/api/persons/models/persons.settings.json b/cms/api/persons/models/persons.settings.json new file mode 100644 index 00000000..f50483a5 --- /dev/null +++ b/cms/api/persons/models/persons.settings.json @@ -0,0 +1,30 @@ +{ + "kind": "collectionType", + "collectionName": "persons", + "info": { + "name": "persons" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "string" + }, + "avatar": { + "model": "file", + "via": "related", + "allowedTypes": [ + "images", + "files", + "videos" + ], + "plugin": "upload", + "required": false, + "pluginOptions": {} + } + } +} diff --git a/cms/api/persons/services/persons.js b/cms/api/persons/services/persons.js new file mode 100644 index 00000000..6538a8c8 --- /dev/null +++ b/cms/api/persons/services/persons.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) + * to customize this service + */ + +module.exports = {}; From d0bae71e1339afab09d022fc90059cace59c233e Mon Sep 17 00:00:00 2001 From: nkpatel23122000 Date: Thu, 17 Feb 2022 12:47:03 +0530 Subject: [PATCH 3/5] removed unused var --- app/components/personcircle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/personcircle.js b/app/components/personcircle.js index 614c7a9c..70041754 100644 --- a/app/components/personcircle.js +++ b/app/components/personcircle.js @@ -1,4 +1,4 @@ -import { Button, ButtonGroup, Col } from "react-bootstrap"; +import { Col } from "react-bootstrap"; import styles from "../styles/Personacircle.module.css"; import {getStrapiURL } from '../lib/api'; export default function Personcircle({persons}) { From 21704ff22eef9741f23e426f1aa5b7947a0645ba Mon Sep 17 00:00:00 2001 From: nik23122000 <2018itnis008@ldce.ac.in> Date: Thu, 14 Apr 2022 19:34:52 +0530 Subject: [PATCH 4/5] added into strapi --- app/pages/index.js | 7 ++- cms/api/discourse/config/routes.json | 52 +++++++++++++++++++ cms/api/discourse/controllers/discourse.js | 8 +++ cms/api/discourse/models/discourse.js | 8 +++ .../discourse/models/discourse.settings.json | 27 ++++++++++ cms/api/discourse/services/discourse.js | 8 +++ 6 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 cms/api/discourse/config/routes.json create mode 100644 cms/api/discourse/controllers/discourse.js create mode 100644 cms/api/discourse/models/discourse.js create mode 100644 cms/api/discourse/models/discourse.settings.json create mode 100644 cms/api/discourse/services/discourse.js diff --git a/app/pages/index.js b/app/pages/index.js index fdae634a..31f61c53 100644 --- a/app/pages/index.js +++ b/app/pages/index.js @@ -11,7 +11,6 @@ import { fetchAPI } from '../lib/api'; import { withFirebaseAuthUser } from '../components/auth/firebase'; function Home(props) { - console.log(props); return ( <> @@ -68,7 +67,7 @@ function Home(props) {

Community Activity

- +
@@ -83,13 +82,13 @@ export async function getStaticProps({ params }) { const releaseNotes = await fetchAPI('/release-notes'); const infotiles=await fetchAPI('/infotiles'); const counters=await fetchAPI('/counters'); - const communityActivities=await fetchAPI('/community-activities'); + const discourses=await fetchAPI('/discourses'); const topNavItems = await fetchAPI('/top-nav-item'); return { - props: { carousels, persons, guides, releaseNotes, topNavItems,infotiles,counters,communityActivities }, + props: { carousels, persons, guides, releaseNotes, topNavItems,infotiles,counters,discourses }, // Next.js will attempt to re-generate the page: // - When a request comes in // - At most once every 1 second diff --git a/cms/api/discourse/config/routes.json b/cms/api/discourse/config/routes.json new file mode 100644 index 00000000..c1828d63 --- /dev/null +++ b/cms/api/discourse/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/discourses", + "handler": "discourse.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/discourses/count", + "handler": "discourse.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/discourses/:id", + "handler": "discourse.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/discourses", + "handler": "discourse.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/discourses/:id", + "handler": "discourse.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/discourses/:id", + "handler": "discourse.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/cms/api/discourse/controllers/discourse.js b/cms/api/discourse/controllers/discourse.js new file mode 100644 index 00000000..e8608953 --- /dev/null +++ b/cms/api/discourse/controllers/discourse.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers) + * to customize this controller + */ + +module.exports = {}; diff --git a/cms/api/discourse/models/discourse.js b/cms/api/discourse/models/discourse.js new file mode 100644 index 00000000..0054d33c --- /dev/null +++ b/cms/api/discourse/models/discourse.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) + * to customize this model + */ + +module.exports = {}; diff --git a/cms/api/discourse/models/discourse.settings.json b/cms/api/discourse/models/discourse.settings.json new file mode 100644 index 00000000..9888489c --- /dev/null +++ b/cms/api/discourse/models/discourse.settings.json @@ -0,0 +1,27 @@ +{ + "kind": "collectionType", + "collectionName": "discourses", + "info": { + "name": "discourse" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "text" + }, + "time": { + "type": "string" + }, + "upvotes": { + "type": "biginteger" + }, + "comments": { + "type": "biginteger" + } + } +} diff --git a/cms/api/discourse/services/discourse.js b/cms/api/discourse/services/discourse.js new file mode 100644 index 00000000..6538a8c8 --- /dev/null +++ b/cms/api/discourse/services/discourse.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) + * to customize this service + */ + +module.exports = {}; From 722ad3eaa6c88e17fefd83be2d30dad7026a5802 Mon Sep 17 00:00:00 2001 From: nishant23122000 Date: Sat, 16 Apr 2022 18:11:37 +0530 Subject: [PATCH 5/5] optimize and initialization of data --- app/components/infotiles.js | 4 +- app/components/personcircle.js | 14 ++- app/pages/index.js | 10 +- app/styles/Personacircle.module.css | 6 +- cms/api/persona-icon/config/routes.json | 52 +++++++++ .../persona-icon/controllers/persona-icon.js | 8 ++ cms/api/persona-icon/models/persona-icon.js | 8 ++ .../models/persona-icon.settings.json | 24 +++++ cms/api/persona-icon/services/persona-icon.js | 8 ++ cms/api/persona/models/persona.settings.json | 16 +-- cms/config/functions/fetchData.js | 88 ++++++++++++++- cms/config/initialData/counters.json | 26 +++++ cms/config/initialData/discourses.json | 102 ++++++++++++++++++ cms/config/initialData/index.js | 12 ++- cms/config/initialData/infotiles.json | 34 ++++++ cms/config/initialData/persona-icons.json | 38 +++++++ 16 files changed, 423 insertions(+), 27 deletions(-) create mode 100644 cms/api/persona-icon/config/routes.json create mode 100644 cms/api/persona-icon/controllers/persona-icon.js create mode 100644 cms/api/persona-icon/models/persona-icon.js create mode 100644 cms/api/persona-icon/models/persona-icon.settings.json create mode 100644 cms/api/persona-icon/services/persona-icon.js create mode 100644 cms/config/initialData/counters.json create mode 100644 cms/config/initialData/discourses.json create mode 100644 cms/config/initialData/infotiles.json create mode 100644 cms/config/initialData/persona-icons.json diff --git a/app/components/infotiles.js b/app/components/infotiles.js index 93214736..2d7f2028 100644 --- a/app/components/infotiles.js +++ b/app/components/infotiles.js @@ -2,11 +2,11 @@ import Image from "next/image"; import Link from "next/link"; import Styles from "../styles/Infotiles.module.css"; -export default function Infotiles(data) { +export default function Infotiles(props) { return ( <> - {data && data.infotiles && data.infotiles.length && data.infotiles.map((obj) => ( + {props?.infotiles?.map((obj) => (
{ + let Icon = dynamic(() => import('react-icons/fa').then(icons => icons[iconName])); + return ; +} + export default function Personcircle({persons}) { return ( <> @@ -11,7 +19,9 @@ export default function Personcircle({persons}) { return (
- + + { fetchIcon(person?.persona_icon?.icon) } +
{person.name}
diff --git a/app/pages/index.js b/app/pages/index.js index 31f61c53..a6af0014 100644 --- a/app/pages/index.js +++ b/app/pages/index.js @@ -41,11 +41,11 @@ function Home(props) { - +
- +
@@ -55,19 +55,19 @@ function Home(props) {

Latest Community News

- +

Get What You Need...

- +

Community Activity

- +
diff --git a/app/styles/Personacircle.module.css b/app/styles/Personacircle.module.css index 00c18e29..0ae3668d 100644 --- a/app/styles/Personacircle.module.css +++ b/app/styles/Personacircle.module.css @@ -7,13 +7,15 @@ flex-direction: column; align-items: center; justify-content: space-between; - gap: 1rem; + gap: 3rem; width: clamp(8rem, 14vw, 20rem); margin: 0.2rem; padding-bottom: 1rem; } .svg { - width: clamp(3rem, 4vw, 4rem); + text-align: center; + transform: scale(4); + color: #1D74F5; } .title { font-size: clamp(0.9rem, 2vw, 1.4rem); diff --git a/cms/api/persona-icon/config/routes.json b/cms/api/persona-icon/config/routes.json new file mode 100644 index 00000000..0e578b1e --- /dev/null +++ b/cms/api/persona-icon/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/persona-icons", + "handler": "persona-icon.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/persona-icons/count", + "handler": "persona-icon.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/persona-icons/:id", + "handler": "persona-icon.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/persona-icons", + "handler": "persona-icon.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/persona-icons/:id", + "handler": "persona-icon.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/persona-icons/:id", + "handler": "persona-icon.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/cms/api/persona-icon/controllers/persona-icon.js b/cms/api/persona-icon/controllers/persona-icon.js new file mode 100644 index 00000000..e8608953 --- /dev/null +++ b/cms/api/persona-icon/controllers/persona-icon.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers) + * to customize this controller + */ + +module.exports = {}; diff --git a/cms/api/persona-icon/models/persona-icon.js b/cms/api/persona-icon/models/persona-icon.js new file mode 100644 index 00000000..0054d33c --- /dev/null +++ b/cms/api/persona-icon/models/persona-icon.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) + * to customize this model + */ + +module.exports = {}; diff --git a/cms/api/persona-icon/models/persona-icon.settings.json b/cms/api/persona-icon/models/persona-icon.settings.json new file mode 100644 index 00000000..75807614 --- /dev/null +++ b/cms/api/persona-icon/models/persona-icon.settings.json @@ -0,0 +1,24 @@ +{ + "kind": "collectionType", + "collectionName": "persona_icons", + "info": { + "name": "persona-icon" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "icon": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "color": { + "type": "string" + } + } +} diff --git a/cms/api/persona-icon/services/persona-icon.js b/cms/api/persona-icon/services/persona-icon.js new file mode 100644 index 00000000..6538a8c8 --- /dev/null +++ b/cms/api/persona-icon/services/persona-icon.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) + * to customize this service + */ + +module.exports = {}; diff --git a/cms/api/persona/models/persona.settings.json b/cms/api/persona/models/persona.settings.json index 22fc6741..974fcd0b 100644 --- a/cms/api/persona/models/persona.settings.json +++ b/cms/api/persona/models/persona.settings.json @@ -2,7 +2,8 @@ "kind": "collectionType", "collectionName": "personas", "info": { - "name": "persona" + "name": "persona", + "description": "" }, "options": { "increments": true, @@ -14,17 +15,8 @@ "name": { "type": "string" }, - "avatar": { - "model": "file", - "via": "related", - "allowedTypes": [ - "images", - "files", - "videos" - ], - "plugin": "upload", - "required": false, - "pluginOptions": {} + "persona_icon": { + "model": "persona-icon" } } } diff --git a/cms/config/functions/fetchData.js b/cms/config/functions/fetchData.js index 014d2881..b8ea7db0 100644 --- a/cms/config/functions/fetchData.js +++ b/cms/config/functions/fetchData.js @@ -6,13 +6,18 @@ const { carousels, subMenus, topNavItem, speakers, - forms } = require('../initialData'); + forms, + discourses, + counters, + infotiles + } = require('../initialData'); const { githubKit } = require('./github'); module.exports = async () => { try { var carouselCount = await strapi.query("carousel").count(); + var personaIconsCount = await strapi.query("persona-icon").count(); var personaCount = await strapi.query("persona").count(); var subMenuCount = await strapi.query("sub-menu").count(); var topNavItemCount = await strapi.query("top-nav-item").count(); @@ -21,7 +26,9 @@ module.exports = async () => { var formCount = await strapi.query("form").count(); var ghrepos = await strapi.query("github-repositories").count({}); var speakersCount = await strapi.query("speaker").count({}); - + var discourseCount = await strapi.query("discourse").count(); + var counterCount = await strapi.query("counter").count(); + var infotileCounter=await strapi.query("infotile").count(); // initial fetch speakers.map(async (speaker, index) => { if (index <= speakersCount - 1) { @@ -99,6 +106,25 @@ module.exports = async () => { } }); + personaIcons.map(async (personaIcon, index) => { + if (index <= personaIconsCount - 1) { + await strapi.query("persona-icon").update( + { id: personaIcon.id }, + { + icon: personaIcon.icon, + size: personaIcon.size, + color: personaIcon.color, + } + ); + } else { + await strapi.query("persona-icon").create({ + icon: personaIcon.icon, + size: personaIcon.size, + color: personaIcon.color, + }); + } + }); + persona.map(async (persona, index) => { if (index <= personaCount - 1) { await strapi.query("persona").update( @@ -143,6 +169,64 @@ module.exports = async () => { } }); + discourses.map(async (discourse, index) => { + if (index <= discourseCount - 1) { + + await strapi.query("discourse").update( + { id: discourse.id }, + { + title: discourse.title, + time: discourse.time, + upvotes: discourse.upvotes, + comments: discourse.comments, + } + ); + } else { + await strapi.query("discourse").create({ + title: discourse.title, + time: discourse.time, + upvotes: discourse.upvotes, + comments: discourse.comments, + }); + } + }); + + counters.map(async (counter, index) => { + if (index <= counterCount - 1) { + + await strapi.query("counter").update( + { id: counter.id }, + { + count: counter.count, + title: counter.title, + } + ); + } else { + await strapi.query("counter").create({ + count: counter.count, + title: counter.title, + }); + } + }); + + infotiles.map(async (infotile, index) => { + if (index <= infotileCounter - 1) { + + await strapi.query("infotile").update( + { id: infotile.id }, + { + title: infotile.title, + description: infotile.description, + } + ); + } else { + await strapi.query("infotile").create({ + title: infotile.title, + description: infotile.description, + }); + } + }); + if (releaseNotesCount) { await strapi.query("release-notes").update( { id: 1 }, diff --git a/cms/config/initialData/counters.json b/cms/config/initialData/counters.json new file mode 100644 index 00000000..3b8bb206 --- /dev/null +++ b/cms/config/initialData/counters.json @@ -0,0 +1,26 @@ +[ + { + "id": 1, + "count": 343433, + "title": "Users", + "published_at": "2022-04-16T11:56:43.525Z", + "created_at": "2022-04-16T11:56:38.281Z", + "updated_at": "2022-04-16T11:56:43.540Z" + }, + { + "id": 2, + "count": 1294056, + "title": "Messages", + "published_at":"2022-04-16T11:56:54.753Z", + "created_at": "2022-04-16T11:56:53.180Z", + "updated_at": "2022-04-16T11:56:54.769Z" + }, + { + "id": 3, + "count": 507, + "title": "Online", + "published_at": "2022-04-16T11:57:22.753Z", + "created_at": "2022-04-16T11:57:21.361Z", + "updated_at": "2022-04-16T11:57:21.368Z" + } + ] \ No newline at end of file diff --git a/cms/config/initialData/discourses.json b/cms/config/initialData/discourses.json new file mode 100644 index 00000000..e20b7740 --- /dev/null +++ b/cms/config/initialData/discourses.json @@ -0,0 +1,102 @@ +[ + { + "id": 1, + "title": "Upload stuck at 0% again after initially fixing with chanding site url in General admin options", + "time": "6:57 PM", + "upvotes": "89", + "comments": "91", + "published_at": "2022-04-16T10:07:51.063Z", + "created_at": "2022-04-16T10:07:51.076Z", + "updated_at": "2022-04-16T10:07:51.076Z" + }, + { + "id": 2, + "title": "Why can’t we have thumbnails for video uploads on mobile?", + "time": "4:00 PM", + "upvotes": "500", + "comments": "4", + "published_at": "2022-04-16T10:07:51.063Z", + "created_at": "2022-04-16T10:07:51.203Z", + "updated_at": "2022-04-16T10:07:51.203Z" + }, + { + "id": 3, + "title": "Can’t find “Users must use Two Factor Authentication” Option", + "time": "12:53 PM", + "upvotes": "456", + "comments": "75", + "published_at": "2022-04-16T10:07:51.063Z", + "created_at": "2022-04-16T10:07:51.328Z", + "updated_at": "2022-04-16T10:07:51.328Z" + }, + { + "id": 4, + "title": "Can’t “forget/remove my data” directly in RC 4.3.0 in livechat", + "time": "8:36 AM", + "upvotes": "234", + "comments": "199", + "published_at": "2022-04-16T10:07:51.063Z", + "created_at": "2022-04-16T10:07:51.454Z", + "updated_at": "2022-04-16T10:07:51.454Z" + }, + { + "id": 5, + "title": "Not migrating, control is locked", + "time": "11:30 PM", + "upvotes": "441", + "comments": "74", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:51.570Z", + "updated_at": "2022-04-16T10:07:51.570Z" + }, + { + "id": 6, + "title": "Upload stuck at 0% again after initially fixing with chanding site url in General admin options", + "time": "7:14 PM", + "upvotes": "972", + "comments": "42", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:51.695Z", + "updated_at": "2022-04-16T10:07:51.695Z" + }, + { + "id": 7, + "title": "Can’t find “Users must use Two Factor Authentication” Option", + "time": "3:36 PM", + "upvotes": "4279", + "comments": "98", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:51.826Z", + "updated_at": "2022-04-16T10:07:51.826Z" + }, + { + "id": 8, + "title": "Cannot Chat Log Level - Option has disappeared", + "time": "11:06 AM", + "upvotes": "51", + "comments": "291", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:51.951Z", + "updated_at": "2022-04-16T10:07:51.951Z" + }, + { + "id": 9, + "title": "Wrong IP Server", + "time": "2:00 PM", + "upvotes": "478", + "comments": "25", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:52.078Z", + "updated_at": "2022-04-16T10:07:52.078Z" + }, + { + "id": 10, + "title": "Not migrating, control is locked", + "time": "11:03 PM", + "upvotes": "16", + "comments": "15", + "published_at": "2022-04-16T10:07:51.064Z", + "created_at": "2022-04-16T10:07:52.212Z", + "updated_at": "2022-04-16T10:07:52.212Z" + } +] \ No newline at end of file diff --git a/cms/config/initialData/index.js b/cms/config/initialData/index.js index 3dd07be7..6c688972 100644 --- a/cms/config/initialData/index.js +++ b/cms/config/initialData/index.js @@ -1,19 +1,27 @@ const carousels = require("./carousels.json"); const guides = require("./guides.json"); const persona = require("./personas.json"); +const personaIcons = require("./persona-icons.json"); const releaseNotes = require("./release-notes.json"); const subMenus = require("./sub-menus.json"); const topNavItem = require("./top-nav-item.json"); const forms = require("./forms.json") -const speakers = require("./speakers.json") +const speakers = require("./speakers.json"); +const discourses=require('./discourses.json'); +const counters=require('./counters.json'); +const infotiles=require('./infotiles.json'); module.exports = { carousels, guides, persona, + personaIcons, releaseNotes, subMenus, topNavItem, forms, - speakers + speakers, + discourses, + counters, + infotiles }; \ No newline at end of file diff --git a/cms/config/initialData/infotiles.json b/cms/config/initialData/infotiles.json new file mode 100644 index 00000000..fadef4b2 --- /dev/null +++ b/cms/config/initialData/infotiles.json @@ -0,0 +1,34 @@ +[ + { + "id": 1, + "title": "Documentation", + "description": "Find in-depth information about Rocket.Chat features and API.", + "published_at": "2022-04-16T12:13:24.232Z", + "created_at": "2022-04-16T12:13:21.138Z", + "updated_at": "2022-04-16T12:13:24.246Z" + }, + { + "id": 2, + "title": "Learn", + "description": "Learn about Rocket.Chat in an interactive course with quizzes!", + "published_at": "2022-04-16T12:13:40.861Z", + "created_at": "2022-04-16T12:13:35.389Z", + "updated_at": "2022-04-16T12:13:40.875Z" + }, + { + "id": 3, + "title": "Examples", + "description": "Discover and deploy boilerplate example Rocket.Chat projects.", + "published_at": "2022-04-16T12:13:59.714Z", + "created_at": "2022-04-16T12:13:50.649Z", + "updated_at": "2022-04-16T12:13:59.737Z" + }, + { + "id": 4, + "title": "Deploy", + "description": "Instantly deploy your Rocket.Chat site to a public URL with Rocket.Chat SaaS.", + "published_at": "2022-04-16T12:14:24.720Z", + "created_at": "2022-04-16T12:14:20.916Z", + "updated_at": "2022-04-16T12:14:24.733Z" + } + ] \ No newline at end of file diff --git a/cms/config/initialData/persona-icons.json b/cms/config/initialData/persona-icons.json new file mode 100644 index 00000000..9f8d1606 --- /dev/null +++ b/cms/config/initialData/persona-icons.json @@ -0,0 +1,38 @@ +[ + { + "id": 1, + "icon": "FaUserLock", + "size": 50, + "color": "black", + "published_at": "2021-06-21T09:03:49.990Z", + "created_at": "2021-06-21T09:03:50.881Z", + "updated_at": "2021-06-21T09:03:50.881Z" + }, + { + "id": 2, + "icon": "FaLaptopCode", + "size": 50, + "color": "black", + "published_at": "2021-06-21T09:03:49.990Z", + "created_at": "2021-06-21T09:03:51.215Z", + "updated_at": "2021-06-21T09:03:51.215Z" + }, + { + "id": 3, + "icon": "FaRegCommentDots", + "size": 50, + "color": "black", + "published_at": "2021-06-21T09:03:49.990Z", + "created_at": "2021-06-21T09:03:51.538Z", + "updated_at": "2021-06-21T09:03:51.538Z" + }, + { + "id": 4, + "icon": "FaRegSun", + "size": 50, + "color": "black", + "published_at": "2021-06-21T09:03:49.990Z", + "created_at": "2021-06-21T09:03:51.884Z", + "updated_at": "2021-06-21T09:03:51.884Z" + } + ] \ No newline at end of file