Skip to content

Commit d548e39

Browse files
committed
branding
1 parent 3ca4af8 commit d548e39

31 files changed

+176
-2700
lines changed

api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (a *API) RegisterRoutes(router *mux.Router) {
9595
router.HandleFunc("/health", a.getHealth).Methods("GET")
9696

9797
router.HandleFunc("/auth/login", a.postAuthLogin).Methods("POST")
98+
router.HandleFunc("/branding", a.getBranding).Methods("GET")
9899

99100
authenticatedRouter := router.PathPrefix("").Subrouter()
100101
authenticatedRouter.Use(a.authMiddleware)

api/controllers/console/controller.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package console
22

33
import (
4+
"fmt"
5+
46
"github.com/replicatedhq/embedded-cluster/api/pkg/utils"
57
"github.com/replicatedhq/embedded-cluster/api/types"
8+
"github.com/replicatedhq/embedded-cluster/pkg/release"
69
)
710

811
type Controller interface {
@@ -37,10 +40,14 @@ func NewConsoleController(opts ...ConsoleControllerOption) (*ConsoleController,
3740
}
3841

3942
func (c *ConsoleController) GetBranding() (types.Branding, error) {
40-
// TODO
43+
app := release.GetApplication()
44+
if app == nil {
45+
return types.Branding{}, fmt.Errorf("application not found")
46+
}
47+
4148
return types.Branding{
42-
ApplicationName: "Embedded Cluster",
43-
LogoURL: "https://replicated.com/logo.png",
49+
AppTitle: app.Spec.Title,
50+
AppIcon: app.Spec.Icon,
4451
}, nil
4552
}
4653

api/types/console.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package types
22

33
type Branding struct {
4-
ApplicationName string `json:"applicationName"`
5-
LogoURL string `json:"logoURL"`
4+
AppTitle string `json:"appTitle"`
5+
AppIcon string `json:"appIcon"`
66
}

cmd/installer/cli/version_embeddeddata.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ func VersionEmbeddedDataCmd(ctx context.Context, name string) *cobra.Command {
1616
RunE: func(cmd *cobra.Command, args []string) error {
1717
// Application
1818
app := release.GetApplication()
19-
fmt.Printf("Application:\n%s\n\n", string(app))
19+
appJson, err := json.MarshalIndent(app, "", " ")
20+
if err != nil {
21+
return fmt.Errorf("failed to marshal application: %w", err)
22+
}
23+
fmt.Printf("Application:\n%s\n\n", string(appJson))
2024

2125
// Embedded Cluster Config
2226
cfg := release.GetEmbeddedClusterConfig()

web/src/App.tsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
1-
import React from 'react';
21
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
32
import { ConfigProvider } from './contexts/ConfigContext';
43
import { WizardModeProvider } from './contexts/WizardModeContext';
4+
import { BrandingProvider } from './contexts/BrandingContext';
55
import InstallWizard from './components/wizard/InstallWizard';
66
import PrototypeSettings from './components/prototype/PrototypeSettings';
77

88
function App() {
99
return (
1010
<ConfigProvider>
11-
<div className="min-h-screen bg-gray-50 text-gray-900 font-sans">
12-
<BrowserRouter>
13-
<Routes>
14-
<Route path="/prototype" element={<PrototypeSettings />} />
15-
<Route
16-
path="/"
17-
element={
18-
<WizardModeProvider mode="install">
19-
<InstallWizard />
20-
</WizardModeProvider>
21-
}
22-
/>
23-
<Route
24-
path="/upgrade"
25-
element={
26-
<WizardModeProvider mode="upgrade">
27-
<InstallWizard />
28-
</WizardModeProvider>
29-
}
30-
/>
31-
<Route path="*" element={<Navigate to="/" replace />} />
32-
</Routes>
33-
</BrowserRouter>
34-
</div>
11+
<BrandingProvider>
12+
<div className="min-h-screen bg-gray-50 text-gray-900 font-sans">
13+
<BrowserRouter>
14+
<Routes>
15+
<Route path="/prototype" element={<PrototypeSettings />} />
16+
<Route
17+
path="/"
18+
element={
19+
<WizardModeProvider mode="install">
20+
<InstallWizard />
21+
</WizardModeProvider>
22+
}
23+
/>
24+
<Route
25+
path="/upgrade"
26+
element={
27+
<WizardModeProvider mode="upgrade">
28+
<InstallWizard />
29+
</WizardModeProvider>
30+
}
31+
/>
32+
<Route path="*" element={<Navigate to="/" replace />} />
33+
</Routes>
34+
</BrowserRouter>
35+
</div>
36+
</BrandingProvider>
3537
</ConfigProvider>
3638
);
3739
}
3840

39-
export default App;
41+
export default App;

web/src/components/common/Logo.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import React from 'react';
22

3-
export const GiteaLogo: React.FC<{ className?: string }> = ({ className = 'w-6 h-6' }) => {
3+
import { useBranding } from '../../contexts/BrandingContext';
4+
5+
export const AppIcon: React.FC<{ className?: string }> = ({ className = 'w-6 h-6' }) => {
6+
const { branding } = useBranding();
7+
if (!branding?.appIcon) {
8+
return <div className="h-6 w-6 bg-gray-200 rounded"></div>;
9+
}
410
return (
5-
<img
6-
src="https://upload.wikimedia.org/wikipedia/commons/b/bb/Gitea_Logo.svg"
7-
alt="Gitea Logo"
11+
<img
12+
src={branding?.appIcon}
13+
alt="App Icon"
814
className={className}
915
/>
1016
);
11-
};
17+
};

web/src/components/prototype/PrototypeSettings.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import Card from '../common/Card';
3-
import Select from '../common/Select';
4-
import { GiteaLogo } from '../common/Logo';
3+
import { AppIcon } from '../common/Logo';
54
import { useConfig } from '../../contexts/ConfigContext';
65

76
const PrototypeSettings: React.FC = () => {
@@ -45,7 +44,7 @@ const PrototypeSettings: React.FC = () => {
4544
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
4645
<div className="flex justify-between items-center py-4">
4746
<div className="flex items-center space-x-3">
48-
<GiteaLogo className="h-10 w-10" />
47+
<AppIcon className="h-10 w-10" />
4948
<div>
5049
<h1 className="text-xl font-semibold text-gray-900">Prototype Settings</h1>
5150
<p className="text-sm text-gray-500">Configure prototype behavior</p>

web/src/components/wizard/CompletionStep.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import React, { useState } from 'react';
22
import Card from '../common/Card';
33
import Button from '../common/Button';
44
import { useConfig } from '../../contexts/ConfigContext';
5+
import { useBranding } from '../../contexts/BrandingContext';
56
import { CheckCircle, ExternalLink, Copy, ClipboardCheck } from 'lucide-react';
67

78
const CompletionStep: React.FC = () => {
89
const { config, prototypeSettings } = useConfig();
10+
const { branding } = useBranding();
911
const [copied, setCopied] = useState(false);
1012
const themeColor = prototypeSettings.themeColor;
1113

1214
const baseUrl = `${config.useHttps ? 'https' : 'http'}://${config.domain}`;
1315
const urls = [
14-
{ name: 'Web Interface', url: baseUrl, description: 'Access the main Gitea interface' },
15-
{ name: 'API Documentation', url: `${baseUrl}/api/swagger`, description: 'Browse and test the Gitea API' }
16+
{ name: 'Web Interface', url: baseUrl, description: `Access the main ${branding?.appTitle} interface` },
17+
{ name: 'API Documentation', url: `${baseUrl}/api/swagger`, description: `Browse and test the ${branding?.appTitle} API` }
1618
];
1719

1820
const copyToClipboard = (text: string) => {
@@ -31,7 +33,7 @@ const CompletionStep: React.FC = () => {
3133
</div>
3234
<h2 className="text-3xl font-bold text-gray-900 mb-4">Installation Complete!</h2>
3335
<p className="text-xl text-gray-600 max-w-2xl mb-8">
34-
Gitea Enterprise is installed successfully.
36+
{branding?.appTitle} is installed successfully.
3537
</p>
3638

3739
<Button
@@ -85,9 +87,9 @@ const CompletionStep: React.FC = () => {
8587
</div>
8688
</div>
8789
<div className="ml-3">
88-
<h4 className="text-base font-medium text-gray-900">Log in to your Gitea Enterprise instance</h4>
90+
<h4 className="text-base font-medium text-gray-900">Log in to your {branding?.appTitle} instance</h4>
8991
<p className="text-sm text-gray-600 mt-1">
90-
Use the administrator credentials you provided during setup to log in to your Gitea Enterprise instance.
92+
Use the administrator credentials you provided during setup to log in to your {branding?.appTitle} instance.
9193
</p>
9294
</div>
9395
</div>

0 commit comments

Comments
 (0)