Skip to content

Commit 401d988

Browse files
committed
Added information label
1 parent 086a8b0 commit 401d988

1 file changed

Lines changed: 10 additions & 31 deletions

File tree

frontend/src/components/DemoNotice/DemoNotice.jsx

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
/**
2-
* DemoNotice Component - GitHub Pages Demo Version Notice
3-
*
4-
* Authors: Dawid Olko & Piotr Smoła
5-
* Date: 2026-02-13
6-
* Version: 1.0
7-
*
8-
* Displays a notice banner when the application is running on GitHub Pages
9-
* to inform users that this is a static preview version with limited functionality.
10-
*
11-
* Features:
12-
* - Automatically detects GitHub Pages environment
13-
* - Shows informative message about limited functionality
14-
* - Only displays on routes that require backend connectivity
15-
* - Responsive design with accessibility support
16-
*
17-
* @component
18-
* @returns {React.ReactElement|null} Demo notice banner or null if not on GitHub Pages
19-
*/
201
import React from "react";
212
import { useLocation } from "react-router-dom";
223
import "./DemoNotice.scss";
234

245
const DemoNotice = () => {
256
const location = useLocation();
267

27-
// Check if we're on GitHub Pages or production environment
8+
const backendRoutes = [
9+
"/admin",
10+
"/client-panel",
11+
"/cart",
12+
"/shop",
13+
"/product",
14+
"/search",
15+
"/category",
16+
];
17+
2818
const isGitHubPages =
2919
typeof window !== "undefined" &&
3020
(window.location.hostname.includes("github.io") ||
@@ -35,23 +25,12 @@ const DemoNotice = () => {
3525
!window.location.hostname.includes("127.0.0.1") &&
3626
!window.location.hostname.includes("0.0.0.0")));
3727

38-
// Debug info
39-
if (typeof window !== "undefined") {
40-
console.log("DemoNotice Debug:", {
41-
hostname: window.location.hostname,
42-
protocol: window.location.protocol,
43-
pathname: location.pathname,
44-
isGitHubPages: isGitHubPages,
45-
});
46-
}
47-
// Check if current route requires backend
4828
const requiresBackend =
4929
backendRoutes.some((route) => location.pathname.startsWith(route)) ||
5030
location.pathname.includes("/product/") ||
5131
location.pathname.includes("/search/") ||
5232
location.pathname.includes("/category/");
5333

54-
// Only show notice on GitHub Pages for routes that need backend
5534
if (!isGitHubPages || !requiresBackend) {
5635
return null;
5736
}

0 commit comments

Comments
 (0)