Skip to content

Commit

Permalink
Merge branch 'master' into scripts_dashboard_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reachaadrika authored Aug 9, 2023
2 parents 5e9b54c + 09273e5 commit e6aad35
Show file tree
Hide file tree
Showing 21 changed files with 617 additions and 169 deletions.
2 changes: 1 addition & 1 deletion components/Hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AlgoliaSearch, { SearchButton } from './AlgoliaSearch'; // Import Algolia
import IconLoupe from './icons/Loupe';
import {
useTranslation,
} from "next-i18next-static-site";
} from "../lib/i18n";

export default function Hero({ className = ''}) {

Expand Down
2 changes: 1 addition & 1 deletion components/link.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { defaultLanguage, languages } from "next-i18next-static-site";
import { defaultLanguage, languages } from "../lib/i18n";

const LinkComponent = ({ children, locale, ...props }) => {
const router = useRouter();
Expand Down
20 changes: 15 additions & 5 deletions components/navigation/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
defaultLanguage,
languages,
useTranslation,
} from "next-i18next-static-site";
} from "../../lib/i18n";
import browserLanguageDetector from "../../lib/browserLanguageDetector";

const isMobile = isMobileDevice();
const uniqueLangs = [...new Set(["EN", "DE"])].map((repo) => ({
Expand All @@ -35,10 +36,15 @@ export default function NavBar({
const { pathname, query, asPath } = router;
const [open, setOpen] = useState();
const [mobileMenuOpen, setMobileMenuOpen] = useState();
const [lang, setLang] = useState("en");
const { i18n } = useTranslation();

const changeLanguage = async (locale) => {
const changeLanguage = async (locale, langPicker) => {

// Verifies if the language change is from langPicker or the browser-api
if(langPicker){
localStorage.setItem('i18nLang', locale);
}

// Detect current language
const slug = asPath.split("/")[1];
const langSlug = languages.includes(slug) && slug;
Expand Down Expand Up @@ -66,6 +72,11 @@ export default function NavBar({
router.push(href);
};

// To be enabled on the last PR
// useEffect(() => {
// changeLanguage(browserLanguageDetector(), false);
// }, []);

function outsideClick(menu) {
if (open !== menu) return;
setOpen(null);
Expand Down Expand Up @@ -172,8 +183,7 @@ export default function NavBar({
{/* <LanguageSelect
options={uniqueLangs}
onChange={(value) => {
setLang(value.toLowerCase());
changeLanguage(value.toLowerCase());
changeLanguage(value.toLowerCase(), true);
}}
className=""
selected={i18n.language.toLocaleUpperCase()}
Expand Down
2 changes: 1 addition & 1 deletion config/all-tags.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"languages":[{"name":"Go/Golang","color":"bg-[#8ECFDF]","borderColor":"border-[#00AFD9]"},{"name":"Java","color":"bg-[#ECA2A4]","borderColor":"border-[#EC2125]"},{"name":"JavaScript","color":"bg-[#F2F1C7]","borderColor":"border-[#BFBE86]"},{"name":"HTML","color":"bg-[#E2A291]","borderColor":"border-[#E44D26]"},{"name":"C/C++","color":"bg-[#93CDEF]","borderColor":"border-[#0080CC]"},{"name":"C#","color":"bg-[#E3AFE0]","borderColor":"border-[#9B4F96]"},{"name":"Python","color":"bg-[#A8D0EF]","borderColor":"border-[#3878AB]"},{"name":"TypeScript","color":"bg-[#7DBCFE]","borderColor":"border-[#2C78C7]"},{"name":"Kotlin","color":"bg-[#B1ACDF]","borderColor":"border-[#756BD9]"},{"name":"Scala","color":"bg-[#FFA299]","borderColor":"border-[#DF301F]"},{"name":"Markdown","color":"bg-[#BABEBF]","borderColor":"border-[#445B64]"},{"name":"YAML","color":"bg-[#FFB764]","borderColor":"border-[#F1901F]"},{"name":"R","color":"bg-[#84B5ED]","borderColor":"border-[#246BBE]"},{"name":"Ruby","color":"bg-[#FF8289]","borderColor":"border-[#FF000F]"},{"name":"Rust","color":"bg-[#FFB8AA]","borderColor":"border-[#E43716]"},{"name":"Shell","color":"bg-[#87D4FF]","borderColor":"border-[#389ED7]"},{"name":"Groovy","color":"bg-[#B6D5E5]","borderColor":"border-[#609DBC]"}],"technologies":[{"name":"Node.js","color":"bg-[#BDFF67]","borderColor":"border-[#84CE24]"},{"name":"Hermes","color":"bg-[#8AEEBD]","borderColor":"border-[#2AB672]"},{"name":"React JS","color":"bg-[#9FECFA]","borderColor":"border-[#08D8FE]"},{"name":".NET","color":"bg-[#A184FF]","borderColor":"border-[#5026D4]"},{"name":"ASP.NET","color":"bg-[#71C2FB]","borderColor":"border-[#1577BC]"},{"name":"Springboot","color":"bg-[#98E279]","borderColor":"border-[#68BC44]"},{"name":"AWS","color":"bg-[#FF9F59]","borderColor":"border-[#EF6703]"},{"name":"Docker","color":"bg-[#B8E0FF]","borderColor":"border-[#2596ED]"},{"name":"Node-RED","color":"bg-[#FF7474]","borderColor":"border-[#8F0101]"},{"name":"Maven","color":"bg-[#FF6B80]","borderColor":"border-[#CA1A33]"},{"name":"Saas","color":"bg-[#6AB8EC]","borderColor":"border-[#2275AD]"},{"name":"Kubernetes-native","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Scala","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Azure","color":"bg-[#4B93FF]","borderColor":"border-[#015ADF]"},{"name":"Jenkins","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Flask","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Nest Js","color":"bg-[#E1224E]","borderColor":"border-[#B9012b]"},{"name":"TypeScript","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Socket.IO","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Liquid","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Kotlin","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Spring Cloud Streams","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"JHipster JDL","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Groovy","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Markdown","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Shell","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"WebComponents","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Babel","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Storybook","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"AsyncAPI Generator","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"JetBrains","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"IntelliJ IDEA","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"VSCode","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"SmartPaste","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"}]}
{"languages":[{"name":"Go/Golang","color":"bg-[#8ECFDF]","borderColor":"border-[#00AFD9]"},{"name":"Java","color":"bg-[#ECA2A4]","borderColor":"border-[#EC2125]"},{"name":"JavaScript","color":"bg-[#F2F1C7]","borderColor":"border-[#BFBE86]"},{"name":"HTML","color":"bg-[#E2A291]","borderColor":"border-[#E44D26]"},{"name":"C/C++","color":"bg-[#93CDEF]","borderColor":"border-[#0080CC]"},{"name":"C#","color":"bg-[#E3AFE0]","borderColor":"border-[#9B4F96]"},{"name":"Python","color":"bg-[#A8D0EF]","borderColor":"border-[#3878AB]"},{"name":"TypeScript","color":"bg-[#7DBCFE]","borderColor":"border-[#2C78C7]"},{"name":"Kotlin","color":"bg-[#B1ACDF]","borderColor":"border-[#756BD9]"},{"name":"Scala","color":"bg-[#FFA299]","borderColor":"border-[#DF301F]"},{"name":"Markdown","color":"bg-[#BABEBF]","borderColor":"border-[#445B64]"},{"name":"YAML","color":"bg-[#FFB764]","borderColor":"border-[#F1901F]"},{"name":"R","color":"bg-[#84B5ED]","borderColor":"border-[#246BBE]"},{"name":"Ruby","color":"bg-[#FF8289]","borderColor":"border-[#FF000F]"},{"name":"Rust","color":"bg-[#FFB8AA]","borderColor":"border-[#E43716]"},{"name":"Shell","color":"bg-[#87D4FF]","borderColor":"border-[#389ED7]"},{"name":"Groovy","color":"bg-[#B6D5E5]","borderColor":"border-[#609DBC]"}],"technologies":[{"name":"Node.js","color":"bg-[#BDFF67]","borderColor":"border-[#84CE24]"},{"name":"Hermes","color":"bg-[#8AEEBD]","borderColor":"border-[#2AB672]"},{"name":"React JS","color":"bg-[#9FECFA]","borderColor":"border-[#08D8FE]"},{"name":".NET","color":"bg-[#A184FF]","borderColor":"border-[#5026D4]"},{"name":"ASP.NET","color":"bg-[#71C2FB]","borderColor":"border-[#1577BC]"},{"name":"Springboot","color":"bg-[#98E279]","borderColor":"border-[#68BC44]"},{"name":"AWS","color":"bg-[#FF9F59]","borderColor":"border-[#EF6703]"},{"name":"Docker","color":"bg-[#B8E0FF]","borderColor":"border-[#2596ED]"},{"name":"Node-RED","color":"bg-[#FF7474]","borderColor":"border-[#8F0101]"},{"name":"Maven","color":"bg-[#FF6B80]","borderColor":"border-[#CA1A33]"},{"name":"Saas","color":"bg-[#6AB8EC]","borderColor":"border-[#2275AD]"},{"name":"Kubernetes-native","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Scala","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Azure","color":"bg-[#4B93FF]","borderColor":"border-[#015ADF]"},{"name":"Jenkins","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Flask","color":"bg-[#D7C7F2]","borderColor":"border-[#A387D2]"},{"name":"Nest Js","color":"bg-[#E1224E]","borderColor":"border-[#B9012b]"},{"name":"TypeScript","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Socket.IO","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Liquid","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Kotlin","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Spring Cloud Streams","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"JHipster JDL","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Groovy","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Markdown","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Shell","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"WebComponents","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Babel","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"Storybook","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"AsyncAPI Generator","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"VSCode","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"SmartPaste","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"JetBrains","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"},{"name":"IntelliJ IDEA","color":"bg-[#61d0f2]","borderColor":"border-[#40ccf7]"}]}
60 changes: 30 additions & 30 deletions config/tools-automated.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,41 @@
}
},
{
"title": "nestjs-asyncapi",
"description": "Utilize decorators to generate AsyncAPI document utilizing DTOs (similar to @nestjs/swagger) and a web UI.",
"title": "SIO-AsyncAPI",
"description": "This is code-first approach to generate AsyncAPI specification from Socket.IO server.",
"links": {
"repoUrl": "https://github.com/flamewow/nestjs-asyncapi"
"websiteUrl": "https://github.com/daler-rahimov/sio-asyncapi",
"docsUrl": "https://github.com/daler-rahimov/sio-asyncapi",
"repoUrl": "https://github.com/daler-rahimov/sio-asyncapi"
},
"filters": {
"language": "Typescript",
"language": "Python",
"technology": [
"Node.js",
"NestJS"
"Socket.IO",
"Flask"
],
"categories": [
"code-first"
"code-first",
"api"
],
"hasCommercial": false,
"isAsyncAPIOwner": false
}
},
{
"title": "SIO-AsyncAPI",
"description": "This is code-first approach to generate AsyncAPI specification from Socket.IO server.",
"title": "nestjs-asyncapi",
"description": "Utilize decorators to generate AsyncAPI document utilizing DTOs (similar to @nestjs/swagger) and a web UI.",
"links": {
"websiteUrl": "https://github.com/daler-rahimov/sio-asyncapi",
"docsUrl": "https://github.com/daler-rahimov/sio-asyncapi",
"repoUrl": "https://github.com/daler-rahimov/sio-asyncapi"
"repoUrl": "https://github.com/flamewow/nestjs-asyncapi"
},
"filters": {
"language": "Python",
"language": "Typescript",
"technology": [
"Socket.IO",
"Flask"
"Node.js",
"NestJS"
],
"categories": [
"code-first",
"api"
"code-first"
],
"hasCommercial": false,
"isAsyncAPIOwner": false
Expand Down Expand Up @@ -495,18 +495,15 @@
"description": "The following is a list of extensions for different IDEs like VSCode, IntelliJ IDEA and others",
"toolsList": [
{
"title": "jAsyncAPI - IDEA plugin",
"description": "Idea plugin for the java-asyncapi - Helps to edit and validate AsyncAPI schemas.",
"title": "asyncapi-preview",
"description": "VSCode extension that enables you to:\n - Preview documentation generated using you AsyncAPI document. It uses AsyncAPI React component under the hood,\n - Create AsyncAPI documents faster using SmartPaste functionality\n",
"links": {
"websiteUrl": "https://plugins.jetbrains.com/plugin/15673-asyncapi",
"docsUrl": "https://github.com/asyncapi/jasyncapi-idea-plugin#usage",
"repoUrl": "https://github.com/asyncapi/jasyncapi-idea-plugin"
"repoUrl": "https://github.com/asyncapi/vs-asyncapi-preview"
},
"filters": {
"language": "Kotlin",
"technology": [
"JetBrains",
"IntelliJ IDEA"
"VSCode",
"SmartPaste"
],
"categories": [
"ide-extension"
Expand All @@ -516,15 +513,18 @@
}
},
{
"title": "asyncapi-preview",
"description": "VSCode extension that enables you to:\n - Preview documentation generated using you AsyncAPI document. It uses AsyncAPI React component under the hood,\n - Create AsyncAPI documents faster using SmartPaste functionality\n",
"title": "jAsyncAPI - IDEA plugin",
"description": "Idea plugin for the java-asyncapi - Helps to edit and validate AsyncAPI schemas.",
"links": {
"repoUrl": "https://github.com/asyncapi/vs-asyncapi-preview"
"websiteUrl": "https://plugins.jetbrains.com/plugin/15673-asyncapi",
"docsUrl": "https://github.com/asyncapi/jasyncapi-idea-plugin#usage",
"repoUrl": "https://github.com/asyncapi/jasyncapi-idea-plugin"
},
"filters": {
"language": "Kotlin",
"technology": [
"VSCode",
"SmartPaste"
"JetBrains",
"IntelliJ IDEA"
],
"categories": [
"ide-extension"
Expand Down
4 changes: 2 additions & 2 deletions cypress/test/Hero.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('Hero Component', () => {
it('displays the correct content', () => {
mount(<Hero />);

cy.contains('Building the future of');
cy.contains('Event-Driven Architectures (EDA)');
cy.contains('main.header');
cy.contains('main.subHeader');
cy.contains('Open-Source tools to easily build and maintain your event-driven architecture.');
cy.contains('Read the docs');
cy.contains('Quick search...');
Expand Down
36 changes: 36 additions & 0 deletions lib/browserLanguageDetector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { i18n } = require("./../next-i18next-static-site.config");

// Converts languages like 'en-US' to 'en'
const convertLanguageCode = (code) => {
const baseLanguageCode = code.split('-')[0];
return baseLanguageCode;
};

function browserLanguageDetector() {

// Fetch the language stored inside localStorage
const localStorageLanguage = localStorage.getItem('i18nLang');

if (localStorageLanguage) {
return localStorageLanguage;
}

// Load available languages from i18n object
const availableLanguages = i18n.languages;

// Load user's default languages from browser settings
const browserDefaultLanguages = navigator.languages;

const convertedLanguages = browserDefaultLanguages.map((code) => convertLanguageCode(code));

// Check if the top priority language is available inside i18n object
for (var i = 0; i < convertedLanguages.length; i++) {
if (availableLanguages.includes(convertedLanguages[i])) {
return convertedLanguages[i];
}
}
// Default to 'en' in all other cases
return 'en';
}

export default browserLanguageDetector;
Loading

0 comments on commit e6aad35

Please sign in to comment.