Skip to content

Commit 6c743bc

Browse files
ronal2doBrummosBtencateSphereon
authored
feat: sync (#54)
* Update dependencies, add TypeScript support, and remove unused files - Updated various dependencies in package.json and package-lock.json to their latest versions, including React, DnD Kit, FontAwesome, and others. - Introduced TypeScript support by adding tsconfig.json and type declarations for SVG and PNG files. - Removed the reportWebVitals.js file and its references from index.js to streamline the application. - Cleaned up devDependencies and ensured compatibility with the latest libraries. * Update package dependencies: remove web-vitals, add @types/file-saver * Refactor components and add TypeScript support - Removed legacy JavaScript files and replaced them with TypeScript versions for improved type safety and maintainability. - Cleaned up unused files and optimized imports across the application. - Implemented conditional rendering for JSONPreview in development mode. * Add Character Management Components in TypeScript SHOWCASE-23 - Replaced the legacy JavaScript CharacterList and NewCharacterButton with TypeScript versions, enhancing type safety and maintainability. - Removed outdated JavaScript files to streamline the codebase and improve overall application structure. * - Converted various credential-related components to TypeScript, improving type safety and maintainability. - Updated existing components to utilize new props and state management patterns. - Cleaned up unused files and optimized imports for better performance and readability. * - Updated CredentialsScreen to utilize new helper functions for managing credentials, attributes, and proof requests. - Enhanced test coverage for credential-related functionalities in json-helper.spec.ts. - Made minor adjustments to types and imports across multiple files for consistency and clarity. * - Renamed `OnboardingScreen` to `OnboardingStep` for clarity and consistency. - Introduced new helper functions for managing onboarding steps, including adding, updating, and removing credentials. - Updated the `OnboardingPage` to handle state management and rendering of onboarding steps effectively. - Enhanced type safety by converting components to TypeScript and updating type definitions. - Cleaned up imports and optimized component structure for better maintainability. * - Added tests for new onboarding step helper functions: `updateOnboardingStep`, `isArrayProperty`, `updateOnboardingStepSingleValue`, `updateOnboardingStepCredentials`, `removeOnboardingStepCredential`, and `addOnboardingStepCredential`. * Implement core application structure with TypeScript support - Added state management using `useImmer` for handling nested JSON structures, enhancing performance and maintainability. - Updated `DEFAULT_JSON` to include a new `screenId` for onboarding steps. - Created a new `ScenarioPage` component to manage scenarios, including adding and editing steps with dynamic credential handling. - Refactored existing components to utilize updated props and state management patterns, ensuring type safety across the application. - Introduced new helper functions for updating JSON properties and managing state transitions effectively. * Migrate project to Next.js and update project structure - Converted project from Create React App to Next.js 14 with TypeScript - Restructured project files and directories to follow Next.js conventions - Added new configuration files: tailwind.config.ts, tsconfig.json - Implemented theme provider and dark mode toggle - Created UI components using shadcn/ui pattern - Removed legacy React and src folder files - Updated dependencies and added Next.js specific configurations * Add Jest configuration and testing setup - Added jest.config.ts for configuring Jest with Next.js - Updated package.json with test scripts and testing library dependencies - Implemented comprehensive test suite for json-helper functions * Refactor Credentials - Migrated credentials and onboarding pages to use modern React hooks and state management - Introduced new `useCredentials` hook for managing credential state - Updated components to use Radix UI and shadcn/ui components - Simplified page layouts with two-column design - Added Zod schema validation for credential form - Removed legacy components and consolidated file structure * Add Language Selector and Radix UI Components - Introduced a new LanguageSelector component with language switching functionality - Added Radix UI Dialog and Popover components for enhanced UI interactions - Updated package.json with new dependencies: @radix-ui/react-dialog, @radix-ui/react-popover, and cmdk - Implemented cookie-based language preference persistence - Created reusable UI components for command palette and dialog interactions * Refactor Onboarding Screen Components - Migrated onboarding screen components to use modern React hooks and state management - Introduced new `useOnboarding` and `useIssueStep` hooks for managing onboarding state - Created Zod schemas for form validation in onboarding steps * Refactor Scenario Screen Components - Migrated scenario screen components to use modern React hooks and state management - Introduced new `useScenarios` hook for managing scenario state - Created Zod schemas for form validation in scenario steps and scenarios * chore: WIP add internationalization * feat: added internationalization * Migrate project to Zustand and add test suite * Add test suite for useShowcaseStore hook * Update .gitignore to exclude .swc directory * Refactor Types and Scenarios with Improved Type Safety - Introduced `scenarioToFormData` transformer for consistent data conversion - Improved type safety in scenario editing and step management - Extracted common utility functions like `convertBase64` - Updated Zod schemas to use literal types and more precise validations - Enhanced test coverage for scenario-related functionality * Replace FontAwesome icons with Lucide icons - Removed @fortawesome/react-fontawesome and @fortawesome/free-solid-svg-icons dependencies - Replaced FontAwesomeIcon components with Lucide icons across multiple components * Update package dependencies and lock file - Upgrade cmdk from 1.0.0 to 1.0.4 - Add @dnd-kit/react package - Update tslib to version 2.8.1 - Remove redundant type dependencies * Add unit tests for utility functions - Create test suite for `cn` class name merging utility - Add test for `convertBase64` file conversion utility * Enhance GitHub Actions workflow with comprehensive CI checks - Add test, lint, and typecheck steps to CI pipeline - Ensure build process runs after all checks pass * Update ESLint configuration and Next.js ESLint package - Disable TypeScript version warning in ESLint configuration - Upgrade eslint-config-next to version 15.1.6 * chore: cleanup * - Update LocalFileUpload component with improved type handling - Add translation support to ProofAttribute and ScenarioStep components - Modify scenario step creation with more flexible title initialization - Update localization files with new translation keys - Remove commented-out code and improve null coalescing * refactor: migrate from next-i18n-router to next-intl for internationalization * refactor: complete migration to next-intl internationalization * refactor: update import path for routing in middleware * refactor: improve navbar layout and styling with responsive grid design * feat: add skeleton loading state for dark mode toggle * refactor: remove react-i18next and update translation imports * chore: add eslint-plugin-react-hooks as a dev dependency * feat: add Pino logging library with comprehensive logging configuration --------- Co-authored-by: A.G.J. Cate <brummos@gmail.com> Co-authored-by: Bram ten Cate <59436492+BtencateSphereon@users.noreply.github.com>
1 parent cc055a5 commit 6c743bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+6179
-16414
lines changed

.github/workflows/Build&Deploy.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ jobs:
1111
- name: Checkout 🛎️
1212
uses: actions/checkout@v2
1313

14-
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
14+
- name: Install 🔧
1515
run: |
1616
unset CI
1717
npm i
18+
19+
- name: Run Tests 🧪
20+
run: |
21+
npm run test
22+
23+
- name: Run Typecheck 📚
24+
run: |
25+
npm run typecheck
26+
27+
- name: Run build 📚
28+
run: |
1829
npm run build
1930
2031
- name: Deploy 🚀
2132
uses: JamesIves/github-pages-deploy-action@v4
2233
with:
23-
branch: gh-pages # The branch the action should deploy to.
24-
folder: build # The folder the action should deploy.
34+
branch: gh-pages
35+
folder: build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ yarn-error.log*
4040
# typescript
4141
*.tsbuildinfo
4242
next-env.d.ts
43+
44+
.idea

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

app/credentials/page.tsx renamed to app/[locale]/credentials/page.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { CredentialsDisplay } from "@/components/credentials/credentials-display";
22
import { CredentialsEditor } from "@/components/credentials/credentials-editor";
3+
import {PageParams} from '@/types';
4+
import { setRequestLocale, getTranslations } from "next-intl/server";
5+
6+
export default async function Credentials({ params }: { params: PageParams }) {
7+
const { locale } = await params
8+
setRequestLocale(locale);
9+
const t = await getTranslations('credentials');
310

4-
export default function Credentials() {
511
return (
612
<div className="flex flex-col min-h-screen mt-20 ">
713
<div className="container mx-auto px-4 py-8 flex-grow">
@@ -10,11 +16,10 @@ export default function Credentials() {
1016
<div className="flex justify-between">
1117
<div>
1218
<h3 className="text-4xl font-bold text-foreground">
13-
Add your Credentials
19+
{t('header_title')}
1420
</h3>
1521
<p className="text-foreground mt-3">
16-
Fill in the details on the right to create a credential for
17-
this showcase.
22+
{t('header_subtitle')}
1823
</p>
1924
</div>
2025
</div>
@@ -28,4 +33,3 @@ export default function Credentials() {
2833
</div>
2934
);
3035
}
31-
File renamed without changes.

app/[locale]/layout.tsx

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import React, { PropsWithChildren } from "react";
2+
import { Montserrat } from "next/font/google";
3+
import { ThemeProvider } from "@/providers/theme-provider";
4+
import { NavBar } from "@/components/navbar";
5+
import { Footer } from "@/components/footer";
6+
import { JSONPreview } from "@/components/json-preview";
7+
import i18nConfig from "@/i18n.config";
8+
import {NextIntlClientProvider} from 'next-intl';
9+
import {getMessages, getTranslations} from 'next-intl/server';
10+
import {routing} from '@/i18n/routing';
11+
import {notFound} from 'next/navigation';
12+
import { Locale, PageParams } from "@/types";
13+
14+
import "./globals.css";
15+
16+
const montserrat = Montserrat({
17+
variable: "--font-montserrat",
18+
subsets: ["latin"],
19+
weight: ["400", "700"],
20+
});
21+
22+
export async function generateMetadata({params}: {params: Promise<{locale: Locale}>}) {
23+
const locale = await params;
24+
const t = await getTranslations({locale, namespace: 'metadata'});
25+
26+
return {
27+
title: t('title'),
28+
description: t('description'),
29+
};
30+
}
31+
32+
export function generateStaticParams() {
33+
return i18nConfig.locales.map(locale => ({ locale }));
34+
}
35+
36+
type Params = PropsWithChildren<{
37+
params: PageParams;
38+
}>
39+
40+
export default async function RootLayout({
41+
children,
42+
params,
43+
}: Params) {
44+
const { locale } = await params
45+
// Ensure that the incoming `locale` is valid
46+
if (!routing.locales.includes(locale)) {
47+
notFound();
48+
}
49+
50+
// Providing all messages to the client
51+
// side is the easiest way to get started
52+
const messages = await getMessages();
53+
54+
return (
55+
<html lang={locale} suppressHydrationWarning>
56+
<body className={`${montserrat.variable} antialiased`}>
57+
<ThemeProvider
58+
attribute="class"
59+
defaultTheme="system"
60+
enableSystem
61+
disableTransitionOnChange
62+
>
63+
<NextIntlClientProvider messages={messages}>
64+
<div className="min-h-screen bg-light-bg dark:bg-dark-bg text-light-text">
65+
<NavBar/>
66+
{children}
67+
{process.env.NODE_ENV === "development" && <JSONPreview />}
68+
<Footer/>
69+
</div>
70+
</NextIntlClientProvider>
71+
</ThemeProvider>
72+
</body>
73+
</html>
74+
);
75+
}

app/onboarding/page.tsx renamed to app/[locale]/onboarding/page.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import { OnboardingScreen } from "@/components/onboarding-screen/onboarding-screen";
22
import { OnboardingSteps } from "@/components/onboarding-screen/onboarding-steps";
3+
import { PageParams } from "@/types";
4+
import { setRequestLocale, getTranslations } from "next-intl/server";
5+
6+
export default async function Onboarding({ params }: { params: PageParams }) {
7+
const { locale } = await params;
8+
setRequestLocale(locale);
9+
const t = await getTranslations("onboarding");
310

4-
export default function Onboarding() {
511
return (
612
<div className="flex flex-col min-h-screen">
713
<div className="flex gap-12 container mx-auto px-4 py-8 mt-20">
814
<div className="w-2/5 rounded left-col text-light-text dark:text-dark-text">
915
<div className="flex w-full">
1016
<div>
1117
<h2 className="text-4xl font-bold text-foreground">
12-
Add your Steps
18+
{t("header_title")}
1319
</h2>
14-
<p className="w-full mt-3">
15-
Add pages below to create the onboarding steps.
16-
</p>
20+
<p className="w-full mt-3">{t("header_subtitle")}</p>
1721
</div>
1822
</div>
1923

app/[locale]/page.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { CharacterForm } from "@/components/character-screen/character-form";
2+
import { CharacterList } from "@/components/character-screen/character-list";
3+
import { setRequestLocale, getTranslations } from "next-intl/server";
4+
import { PageParams } from '@/types';
5+
6+
async function HomePage({ params }: { params: PageParams }) {
7+
const { locale } = await params
8+
setRequestLocale(locale);
9+
const t = await getTranslations('character');
10+
11+
return (
12+
<div className="min-h-screen bg-light-bg dark:bg-dark-bg text-light-text">
13+
<div className="flex flex-col min-h-screen mt-20 text-light-text bg-light-bg dark:bg-dark-bg dark:text-dark-text">
14+
<div className="container mx-auto px-4 py-8 flex-grow">
15+
<div className="flex gap-12 h-full">
16+
<div className="w-2/5 rounded left-col">
17+
<div className="flex justify-between">
18+
<div>
19+
<h3 className="text-4xl font-bold text-foreground">
20+
{t('header_title')}
21+
</h3>
22+
<p className="text-foreground mt-3">
23+
{t('header_subtitle')}
24+
</p>
25+
</div>
26+
</div>
27+
28+
<div className="mt-8">
29+
<div className="flex justify-between mb-4">
30+
<h3 className="text-xl font-bold">{t('your_character_label')}</h3>
31+
</div>
32+
33+
<CharacterList />
34+
</div>
35+
</div>
36+
<CharacterForm />
37+
</div>
38+
</div>
39+
</div>
40+
</div>
41+
);
42+
}
43+
44+
export default HomePage;

app/scenarios/page.tsx renamed to app/[locale]/scenarios/page.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import { EditStepScreen } from "@/components/scenario-screen/edit-step-screen";
22
import { ScenarioScreen } from "@/components/scenario-screen/scenario-screen";
3+
import { PageParams } from "@/types";
4+
import { setRequestLocale, getTranslations } from "next-intl/server";
5+
6+
export default async function Scenario({ params }: { params: PageParams }) {
7+
const { locale } = await params;
8+
setRequestLocale(locale);
9+
const t = await getTranslations("scenario");
310

4-
export default function Scenario() {
511
return (
612
<div className="flex flex-col min-h-screen">
713
<div className="flex gap-12 container mx-auto px-4 py-8 mt-20">
814
<div className="w-2/5 rounded left-col text-foreground">
915
<div className="flex w-full">
1016
<div>
1117
<h2 className="text-4xl font-bold text-foreground">
12-
Create Scenarios
18+
{t('header_title')}
1319
</h2>
1420
<p className="w-full mt-3">
15-
Add pages below to create your scenarios screens and connecting
16-
steps.
21+
{t('header_subtitle')}
1722
</p>
1823
</div>
1924
</div>

app/layout.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/page.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)