From ab726660525601f36efd80f70a28eedae7c4bd43 Mon Sep 17 00:00:00 2001 From: "dennis.ludwig" Date: Wed, 30 Jun 2021 16:51:27 +0200 Subject: [PATCH] Extract AOE specific texts as messages.json --- public/messages.json | 68 ++++++++++++ src/components/App.tsx | 56 ++++++---- src/components/Footer/Footer.tsx | 26 +++-- src/components/FooterEnd/FooterEnd.tsx | 126 ++++++----------------- src/components/SocialIcon/SocialIcon.tsx | 46 +++++++++ src/context/MessagesContext/index.tsx | 46 +++++++++ 6 files changed, 239 insertions(+), 129 deletions(-) create mode 100644 public/messages.json create mode 100644 src/components/SocialIcon/SocialIcon.tsx create mode 100644 src/context/MessagesContext/index.tsx diff --git a/public/messages.json b/public/messages.json new file mode 100644 index 00000000..0db0afac --- /dev/null +++ b/public/messages.json @@ -0,0 +1,68 @@ +{ + "footerFootnote": "AOE is a leading global provider of services for digital transformation and digital business models. AOE relies exclusively on established Enterprise Open Source technologies. This leads to innovative solutions, digital products and portals in agile software projects, and helps build long-lasting, strategic partnerships with our customers.", + "socialLinks": [ + { "href": "https://www.facebook.com/aoepeople", "iconName": "facebook" }, + { "href": "https://twitter.com/aoepeople", "iconName": "twitter" }, + { "href": "https://www.linkedin.com/company/aoe", "iconName": "linkedIn" }, + { "href": "https://www.xing.com/company/aoe", "iconName": "xing" }, + { "href": "https://www.instagram.com/aoepeople", "iconName": "instagram" }, + { "href": "https://www.youtube.com/user/aoepeople", "iconName": "youtube" }, + { "href": "https://github.com/aoepeople", "iconName": "github" } + ], + "pageHelp": { + "introduction": [ + "Technology is moving fast and new technologies and innovations appear continuously.", + "It's essential for a development and technology company such as AOE to constantly improve and keep track with the latest useful innovations. It is important to openly look for innovations and new technologies and to question established technologies and methods every now and then.", + "But, it is also important to wisely choose which technologies to use in our daily work and in the different projects we are carrying out. As we all know: There is no silver bullet." + ], + "whatIsTheRadar": [ + "The Tech Radar is an overview of different technologies - from languages, frameworks, tools and patterns to platforms - that we consider \"new or mentionable\". The radar therefore doesn't provide an overview of all established technologies - but it focuses on items that have recently gained in importance or changed." + ], + "howItIsCreated": [ + "The items in the technology radar are raised by the different teams and therefore a lot of the items are related to the work and challenges the teams face in the different projects. In fact, we don't include anything on the radar, which we haven't already tried ourselves at least once.", + "There have been a lot of valuable discussions in different expert groups about the classification and details of each of technologies and innovations. And the result of all this can be found in the latest technology radar." + ], + "howShouldItBeUsed": [ + "The radar acts as an overview of technologies that we think everyone in the teams should currently know about.", + "Its goal is to act as a guide and inspiration for the daily work in the teams. Its purpose is also to provide helpful information and a bird's-eye perspective - so that decisions can be taken with a much deeper understanding of the subject matter. This results in more-informed and better-aligned decisions.", + "We also hope that developers outside of AOE find the information in our technology overview inspirational.", + "We group or categorize the items in 4 quadrants - (sometimes, when it's not 100% clear where a item belongs, we choose the best fit)." + ], + "quadrants": [ + { + "name": "Languages and Frameworks", + "description": "We've placed development languages (such as Scala or Golang) here, as well as more low-level development frameworks (such as Play or Symfony), which are useful for implementing custom software of all kinds." + }, + { + "name": "Tools", + "description": "Here we put different software tools - from small helpers to bigger software projects" + }, + { + "name": "Methods and Patterns", + "description": "Patterns are so important, and a lot of them are valid for a long time (compared to some tools or frameworks). So, this is the category where we put information on methods and patterns concerning development, continuous x, testing, organization, architecture, etc." + }, + { + "name": "Platforms and Operations", + "description": "(including AOE internal Services): Here we include infrastructure platforms and services. We also use this category to communicate news about AOE services that we want all AOE teams to be aware of." + } + ], + "rings": [ + { + "name": "Adopt", + "description": "We can clearly recommend this technology. We have used it for longer period of time in many teams and it has proven to be stable and useful." + }, + { + "name": "Trial", + "description": "We have used it with success and recommend to have a closer look at the technology in this ring. The goal of items here is to look at them more closely, with the goal to bring them to the adopt level." + }, + { + "name": "Assess", + "description": "We have tried it out and we find it promising. We recommend having a look at these items when you face a specific need for the technology in your project." + }, + { + "name": "Hold", + "description": "This category is a bit special. Unlike the others, we recommend to stop doing or using something. That does not mean that they are bad and it often might be ok to use them in existing projects. But we move things here if we think we shouldn't do them anymore - because we see better options or alternatives now." + } + ] + } +} diff --git a/src/components/App.tsx b/src/components/App.tsx index bfb76a17..c3e4053c 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -12,6 +12,7 @@ import { useLocation, } from "react-router-dom"; import { Item } from "../model"; +import { Messages, MessagesProvider } from "../context/MessagesContext"; interface Params { page: string; @@ -60,6 +61,8 @@ interface Data { export default function App() { const [data, setData] = React.useState(); + const [messages, setMessages] = React.useState(); + React.useEffect(() => { fetch(`${process.env.PUBLIC_URL}/rd.json`) .then((response) => response.json()) @@ -69,33 +72,44 @@ export default function App() { .catch((error) => { console.error("fetch data", error); }); + + fetch(`${process.env.PUBLIC_URL}/messages.json`) + .then((response) => response.json()) + .then((messages: Messages) => { + setMessages(messages); + }) + .catch((error) => { + console.error("fetch messages", error); + }); }, []); - if (data) { + if (data && messages) { const { items, releases } = data; return ( - - - -
-
-
- -
-
- -
-
- + + + + +
+
+
+ +
+
+ +
+
+ +
-
- - - - - - + + + + + + + ); } diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 04be5e07..47ba59a9 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -5,13 +5,16 @@ import FooterEnd from "../FooterEnd/FooterEnd"; import { assetUrl, getItemPageNames, isMobileViewport } from "../../config"; import { Item } from "../../model"; import "./footer.scss"; -export default function Footer({ - items, - pageName, -}: { +import { useMessages } from "../../context/MessagesContext"; + +interface Props { items: Item[]; pageName: string; -}) { +} + +const Footer: React.FC = ({ items, pageName }) => { + const { footerFootnote } = useMessages(); + return (
} > - - AOE is a leading global provider of services for digital - transformation and digital business models. AOE relies exclusively on - established Enterprise Open Source technologies. This leads to - innovative solutions, digital products and portals in agile software - projects, and helps build long-lasting, strategic partnerships with - our customers. - + {footerFootnote}
); -} +}; + +export default Footer; diff --git a/src/components/FooterEnd/FooterEnd.tsx b/src/components/FooterEnd/FooterEnd.tsx index 3e9b65bb..1a97312c 100644 --- a/src/components/FooterEnd/FooterEnd.tsx +++ b/src/components/FooterEnd/FooterEnd.tsx @@ -1,107 +1,45 @@ import React from "react"; import classNames from "classnames"; -import { - FaFacebookF, - FaTwitter, - FaLinkedinIn, - FaXing, - FaYoutube, - FaGithub, - FaInstagram, -} from "react-icons/fa"; +import SocialIcon from "../SocialIcon/SocialIcon"; import "./footerend.scss"; +import { useMessages } from "../../context/MessagesContext"; interface Props { modifier?: "in-sidebar"; } -const FooterEnd: React.FC = ({ modifier }) => ( -
-
-
-

Follow us:

+const FooterEnd: React.FC = ({ modifier }) => { + const { socialIcons } = useMessages(); + + return ( +
+
+
+

Follow us:

+
+
+ {socialIcons.map(({ href, iconName }) => ( + + ))} +
- - -
-); + ); +}; export default FooterEnd; diff --git a/src/components/SocialIcon/SocialIcon.tsx b/src/components/SocialIcon/SocialIcon.tsx new file mode 100644 index 00000000..124a4060 --- /dev/null +++ b/src/components/SocialIcon/SocialIcon.tsx @@ -0,0 +1,46 @@ +import React from "react"; +import { + FaFacebookF, + FaTwitter, + FaLinkedinIn, + FaXing, + FaYoutube, + FaGithub, + FaInstagram, +} from "react-icons/fa"; + +const icons = { + facebook: FaFacebookF, + twitter: FaTwitter, + linkedIn: FaLinkedinIn, + xing: FaXing, + instagram: FaInstagram, + youtube: FaYoutube, + github: FaGithub, +}; + +export interface Props { + href: string; + iconName: keyof typeof icons; +} + +const SocialIcon: React.FC = ({ href, iconName }) => { + const Icon = icons[iconName]; + + if (Icon) { + return ( + + + + ); + } + console.log(`The icon is unknown: ${iconName}`); + return null; +}; + +export default SocialIcon; diff --git a/src/context/MessagesContext/index.tsx b/src/context/MessagesContext/index.tsx new file mode 100644 index 00000000..5e86984e --- /dev/null +++ b/src/context/MessagesContext/index.tsx @@ -0,0 +1,46 @@ +import { createContext, FC, useContext } from "react"; +import { Props as SocialIcon } from "../../components/SocialIcon/SocialIcon"; + +interface Quadrant { + name: string; + description: string; +} + +interface Ring { + name: string; + description: string; +} + +interface PageHelp { + introduction: string[]; + whatIsTheRadar: string[]; + howItIsCreated: string[]; + howShouldItBeUsed: string[]; + quadrants: Quadrant[]; + rings: Ring[]; +} + +export interface Messages { + footerFootnote: string; + socialIcons: SocialIcon[]; + pageHelp: PageHelp; +} + +const MessagesContext = createContext(undefined); + +export const MessagesProvider: FC<{ messages: Messages }> = ({ + messages, + children, +}) => ( + + {children} + +); + +export const useMessages = () => { + const context = useContext(MessagesContext); + if (context === undefined) { + throw new Error("useMessages must be used within a MessagesProvider"); + } + return context; +};