Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/docker-build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILDKIT_INLINE_CACHE=1

# https://github.com/peter-evans/dockerhub-description
- name: Update Docker Hub description
Expand Down
21 changes: 15 additions & 6 deletions ichub-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,26 @@
# Stage 1: Build the React app
FROM node:23-alpine AS builder

# Set working directory first
WORKDIR /app

# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts

# Copy the rest of the source code
COPY . /app
# Install dependencies with optimizations for Docker
RUN npm ci --include=dev --ignore-scripts --prefer-offline

# Set the working directory
WORKDIR /app
# Copy only necessary source files for better caching
COPY src/ ./src/
COPY public/ ./public/
COPY index.html ./
COPY vite.config.ts ./
COPY tsconfig*.json ./

# Set production environment for optimized build
ENV NODE_ENV=production

# Build the application
# Build the application with optimized settings
RUN npm run build


Expand Down
2 changes: 1 addition & 1 deletion ichub-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions ichub-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "vite build",
"build:full": "tsc -b && vite build",
"typecheck": "tsc --noEmit",
"lint": "eslint .",
"preview": "vite preview",
"build:docker": "IMAGE=ichub-frontend && docker build -t $IMAGE -f Dockerfile .",
Expand Down Expand Up @@ -41,4 +43,4 @@
"vite": "^6.1.0",
"vitest": "^3.2.4"
}
}
}
53 changes: 53 additions & 0 deletions ichub-frontend/src/components/general/AdditionalSidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/********************************************************************************
* Eclipse Tractus-X - Industry Core Hub Frontend
*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the
* License for the specific language govern in permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import React from 'react';
import { Box } from '@mui/material';
import { useAdditionalSidebar } from '../../hooks/useAdditionalSidebar';

const AdditionalSidebar: React.FC = () => {
const { isVisible, content } = useAdditionalSidebar();

return (
<Box
sx={{
background: 'linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%)',
height: '100%',
borderRight: '1px solid rgba(59, 130, 246, 0.2)',
boxShadow: '4px 0 16px rgba(30, 58, 138, 0.1)',
width: isVisible ? '320px' : '0px',
flexShrink: 0,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
transition: 'width 0.15s ease-out',
backgroundColor: '#1e3a8a', // Fallback background to prevent gap
}}
>
<Box sx={{ width: '320px', minWidth: '320px' }}>
{content}
</Box>
</Box>
);
};

export default AdditionalSidebar;
51 changes: 51 additions & 0 deletions ichub-frontend/src/components/layout/AdditionalSidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/********************************************************************************
* Eclipse Tractus-X - Industry Core Hub Frontend
*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the
* License for the specific language govern in permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import React from 'react';
import { Box } from '@mui/material';
import { useAdditionalSidebar } from '../../hooks/useAdditionalSidebar';

const AdditionalSidebar: React.FC = () => {
const { isVisible, content } = useAdditionalSidebar();

return (
<Box
sx={{
background: 'linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%)',
height: '100%',
borderRight: '1px solid rgba(59, 130, 246, 0.2)',
boxShadow: '4px 0 16px rgba(30, 58, 138, 0.1)',
width: '320px',
flexShrink: 0,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
transform: isVisible ? 'translateX(0)' : 'translateX(100%)',
transition: 'transform 0.2s ease-out',
}}
>
{content}
</Box>
);
};

export default AdditionalSidebar;
70 changes: 70 additions & 0 deletions ichub-frontend/src/contexts/AdditionalSidebarContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/********************************************************************************
* Eclipse Tractus-X - Industry Core Hub Frontend
*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the
* License for the specific language govern in permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import React, { createContext, useState, ReactNode, useCallback } from 'react';

export interface AdditionalSidebarContextType {
isVisible: boolean;
content: ReactNode;
showSidebar: (content: ReactNode) => void;
hideSidebar: () => void;
toggleSidebar: () => void;
}

export const AdditionalSidebarContext = createContext<AdditionalSidebarContextType | undefined>(undefined);

interface AdditionalSidebarProviderProps {
children: ReactNode;
}

export const AdditionalSidebarProvider: React.FC<AdditionalSidebarProviderProps> = ({ children }) => {
const [isVisible, setIsVisible] = useState(false);
const [content, setContent] = useState<ReactNode>(null);

const showSidebar = useCallback((newContent: ReactNode) => {
setContent(newContent);
setIsVisible(true);
}, []);

const hideSidebar = useCallback(() => {
setIsVisible(false);
setContent(null);
}, []);

const toggleSidebar = useCallback(() => {
setIsVisible(!isVisible);
}, [isVisible]);

return (
<AdditionalSidebarContext.Provider
value={{
isVisible,
content,
showSidebar,
hideSidebar,
toggleSidebar,
}}
>
{children}
</AdditionalSidebarContext.Provider>
);
};
76 changes: 76 additions & 0 deletions ichub-frontend/src/contexts/SidebarContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/********************************************************************************
* Eclipse Tractus-X - Industry Core Hub Frontend
*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the
* License for the specific language govern in permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import React, { createContext, useContext, useState, ReactNode } from 'react';

interface SidebarContextType {
isVisible: boolean;
content: ReactNode | null;
showSidebar: (content: ReactNode) => void;
hideSidebar: () => void;
toggleSidebar: () => void;
}

const SidebarContext = createContext<SidebarContextType | undefined>(undefined);

export const useSidebar = () => {
const context = useContext(SidebarContext);
if (!context) {
throw new Error('useSidebar must be used within a SidebarProvider');
}
return context;
};

interface SidebarProviderProps {
children: ReactNode;
}

export const SidebarProvider: React.FC<SidebarProviderProps> = ({ children }) => {
const [isVisible, setIsVisible] = useState(false);
const [content, setContent] = useState<ReactNode | null>(null);

const showSidebar = (content: ReactNode) => {
setContent(content);
setIsVisible(true);
};

const hideSidebar = () => {
setIsVisible(false);
setContent(null);
};

const toggleSidebar = () => {
setIsVisible(!isVisible);
};

return (
<SidebarContext.Provider value={{
isVisible,
content,
showSidebar,
hideSidebar,
toggleSidebar
}}>
{children}
</SidebarContext.Provider>
);
};
Loading
Loading