create-pb-tririga-react-app 1.0.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/README.md +1 -6
- package/template/public/vite.svg +1 -0
- package/template/src/App.tsx +9 -28
- package/template/src/components/MainLayout.tsx +65 -0
- package/template/src/components/index.ts +1 -1
- package/template/src/main.tsx +1 -1
- package/template/src/pages/HomePage.tsx +17 -0
- package/template/src/pages/index.ts +1 -1
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -13,12 +13,7 @@ This is a template for building IBM TRIRIGA UX applications using React, TypeScr
|
|
|
13
13
|
```
|
|
14
14
|
pnpm install
|
|
15
15
|
```
|
|
16
|
-
|
|
17
|
-
3. **Configure Environment**
|
|
18
|
-
Copy `.env.example` to `.env` and update the values for your local development and deployment settings.
|
|
19
|
-
```
|
|
20
|
-
cp .env.example .env
|
|
21
|
-
```
|
|
16
|
+
|
|
22
17
|
|
|
23
18
|
## Deployment
|
|
24
19
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/template/src/App.tsx
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Routes, Route } from 'react-router-dom';
|
|
2
|
+
import { MainLayout } from './components';
|
|
3
|
+
import { HomePage } from './pages';
|
|
4
4
|
|
|
5
5
|
function App() {
|
|
6
|
-
const [loading, setLoading] = useState(true);
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
// Example: verify model is present
|
|
10
|
-
const model = getAppModel();
|
|
11
|
-
console.log('App loaded with model:', model);
|
|
12
|
-
setLoading(false);
|
|
13
|
-
}, []);
|
|
14
|
-
|
|
15
|
-
if (loading) return <div>Loading TRIRIGA App...</div>;
|
|
16
|
-
|
|
17
6
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
This is a template application using React, Vite, TypeScript, and Carbon Design System.
|
|
25
|
-
</p>
|
|
26
|
-
<Button>Example Button</Button>
|
|
27
|
-
</Column>
|
|
28
|
-
</Grid>
|
|
29
|
-
</Content>
|
|
30
|
-
</Theme>
|
|
31
|
-
)
|
|
7
|
+
<Routes>
|
|
8
|
+
<Route path="/" element={<MainLayout />}>
|
|
9
|
+
<Route index element={<HomePage />} />
|
|
10
|
+
</Route>
|
|
11
|
+
</Routes>
|
|
12
|
+
);
|
|
32
13
|
}
|
|
33
14
|
|
|
34
15
|
export default App
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Header,
|
|
4
|
+
HeaderName,
|
|
5
|
+
HeaderGlobalBar,
|
|
6
|
+
HeaderGlobalAction,
|
|
7
|
+
Theme,
|
|
8
|
+
Content,
|
|
9
|
+
HeaderContainer,
|
|
10
|
+
SkipToContent
|
|
11
|
+
} from '@carbon/react';
|
|
12
|
+
import { UserAvatar, Logout } from '@carbon/icons-react';
|
|
13
|
+
import { Outlet, Link } from 'react-router-dom';
|
|
14
|
+
import { AuthService } from '../services/AuthService';
|
|
15
|
+
|
|
16
|
+
const MainLayout: React.FC = () => {
|
|
17
|
+
const userName = 'User';
|
|
18
|
+
const theme = 'g10';
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Theme theme={theme}>
|
|
22
|
+
<HeaderContainer
|
|
23
|
+
render={() => (
|
|
24
|
+
<>
|
|
25
|
+
<Header aria-label="TRIRIGA App">
|
|
26
|
+
<SkipToContent />
|
|
27
|
+
<HeaderName as={Link} to="/" prefix="TRIRIGA">
|
|
28
|
+
React App
|
|
29
|
+
</HeaderName>
|
|
30
|
+
<HeaderGlobalBar>
|
|
31
|
+
<HeaderGlobalAction aria-label={userName} tooltipAlignment="end">
|
|
32
|
+
<UserAvatar size={20} />
|
|
33
|
+
</HeaderGlobalAction>
|
|
34
|
+
<HeaderGlobalAction
|
|
35
|
+
aria-label="Sign out"
|
|
36
|
+
tooltipAlignment="end"
|
|
37
|
+
onClick={() => AuthService.logout()}
|
|
38
|
+
>
|
|
39
|
+
<Logout size={20} />
|
|
40
|
+
</HeaderGlobalAction>
|
|
41
|
+
</HeaderGlobalBar>
|
|
42
|
+
</Header>
|
|
43
|
+
<Content
|
|
44
|
+
id="main-content"
|
|
45
|
+
style={{
|
|
46
|
+
padding: 0,
|
|
47
|
+
maxWidth: 'none',
|
|
48
|
+
width: 'auto',
|
|
49
|
+
marginTop: '3rem',
|
|
50
|
+
minHeight: 'calc(100vh - 3rem)',
|
|
51
|
+
background: 'var(--cds-layer-01)'
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<div style={{ padding: '2rem' }}>
|
|
55
|
+
<Outlet />
|
|
56
|
+
</div>
|
|
57
|
+
</Content>
|
|
58
|
+
</>
|
|
59
|
+
)}
|
|
60
|
+
/>
|
|
61
|
+
</Theme>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default MainLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { default as MainLayout } from './MainLayout';
|
package/template/src/main.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import './index.css'
|
|
|
5
5
|
import App from './App'
|
|
6
6
|
import { initTriAppConfig } from './services/tririgaService'
|
|
7
7
|
import { createAppModel } from './model/AppModel'
|
|
8
|
-
import { standardTririgaLogin, getAuthCheckerForCurrentApp
|
|
8
|
+
import { standardTririgaLogin, getAuthCheckerForCurrentApp } from '@tririga/tririga-react-components'
|
|
9
9
|
import '@carbon/styles/css/styles.css'
|
|
10
10
|
|
|
11
11
|
// Determine base path when deployed under TRIRIGA like /app/viewName/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Grid, Column, Button } from '@carbon/react';
|
|
2
|
+
|
|
3
|
+
function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<Grid>
|
|
6
|
+
<Column lg={16} md={8} sm={4}>
|
|
7
|
+
<h1 style={{ marginBottom: '1rem' }}>Welcome to your new TRIRIGA React App</h1>
|
|
8
|
+
<p style={{ marginBottom: '2rem' }}>
|
|
9
|
+
This is a template application using React, Vite, TypeScript, and Carbon Design System.
|
|
10
|
+
</p>
|
|
11
|
+
<Button>Example Button</Button>
|
|
12
|
+
</Column>
|
|
13
|
+
</Grid>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default HomePage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { default as HomePage } from './HomePage';
|