Skip to content

Commit 73edf9c

Browse files
committed
Merge branch 'main' into feature/auth
2 parents c4b78b9 + f5624cf commit 73edf9c

File tree

22 files changed

+338
-104
lines changed

22 files changed

+338
-104
lines changed

.github/workflows/deploy-gh.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,30 @@ jobs:
2626
uses: actions/checkout@v4
2727

2828
- name: Use Node.js
29-
uses: actions/setup-node@v3
29+
uses: actions/setup-node@v4
3030
with:
3131
node-version-file: '.nvmrc'
3232

3333
- name: Cache node_modules
34-
uses: actions/cache@v3
34+
uses: actions/cache@v4
3535
id: cache-node-modules
3636
with:
3737
path: node_modules
38-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
38+
key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}
3939

4040
- name: Cache dist
41-
uses: actions/cache@v3
41+
uses: actions/cache@v4
4242
id: cache-dist
4343
with:
4444
path: packages/client/dist
45-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
45+
key: ${{ runner.os }}-build-${{ github.sha }}
4646

4747
- name: Install
4848
run: npm install
4949

50+
- name: Setup SPA on Github Pages
51+
run: node packages/client/tasks/setup-gh-pages.mjs
52+
5053
- name: Build
5154
run: npm run all:build
5255

@@ -59,14 +62,11 @@ jobs:
5962
uses: actions/checkout@v4
6063

6164
- name: Restore dist cache
62-
uses: actions/cache@v3
65+
uses: actions/cache@v4
6366
id: cache-dist
6467
with:
6568
path: packages/client/dist
66-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
67-
68-
- name: Copy index as 400 file for github pages
69-
run: cp packages/client/dist/index.html packages/client/dist/400.html
69+
key: ${{ runner.os }}-build-${{ github.sha }}
7070

7171
- name: Deploy 🚀
7272
uses: JamesIves/github-pages-deploy-action@v4

packages/client/.env

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# App metadata
22
APP_TITLE=STAC Manager
33
APP_DESCRIPTION=Plugin based STAC editor
4-
5-
# If the app is being served in from a subfolder, the domain url must be set.
6-
# For example, if the app is served from /mysite:
7-
# PUBLIC_URL=http://example.com/mysite
4+
## Don't set the public url here. Check the README.md file for more information
5+
# PUBLIC_URL= Do not set here
86

97
# Api variables
108
REACT_APP_STAC_BROWSER=

packages/client/README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Some client options are controlled by environment variables. These are:
1414
## Title and description of the app for metadata
1515
APP_TITLE
1616
APP_DESCRIPTION
17-
18-
# API
1917
## If the app is being served in from a subfolder, the domain url must be set.
2018
PUBLIC_URL
19+
20+
# API
2121
REACT_APP_STAC_BROWSER
2222
REACT_APP_STAC_API
2323
@@ -31,10 +31,39 @@ REACT_APP_THEME_PRIMARY_COLOR
3131
REACT_APP_THEME_SECONDARY_COLOR
3232
```
3333

34+
**Public URL**
35+
It is recommended to always set the `PUBLIC_URL` environment variable on a production build.
36+
If the app is being served from a subfolder, the `PUBLIC_URL` should include the subfolder path. **Do not include a trailing slash.**
37+
38+
For example, if the app is being served from `https://example.com/stac-manager`, the `PUBLIC_URL` should be set to `https://example.com/stac-manager`.
39+
40+
> [!IMPORTANT]
41+
> The `PUBLIC_URL` environment variable must be set before running the build script, and therefore the `.env` file cannot be used to set this variable.
42+
3443
You must provide a value for the `REACT_APP_STAC_API` environment variable. This should be the URL of the STAC API you wish to interact with.
3544

3645
If the `REACT_APP_STAC_BROWSER` environment variable is not set, [Radiant Earth's STAC Browser](https://radiantearth.github.io/stac-browser/) will be used by default, which will connect to the STAC API specified in `REACT_APP_STAC_API`.
3746

3847
**Auth**
3948
The client uses Keycloack for authentication, which is disabled by default. To
40-
enable it you must provide values for the `REACT_APP_KEYCLOAK_*` environment variables. These can be obtained through the Keycloak server.
49+
enable it you must provide values for the `REACT_APP_KEYCLOAK_*` environment variables. These can be obtained through the Keycloak server.
50+
51+
### Theming
52+
53+
The Stac manager client allows for simple theming to give the instance a different look and feel.
54+
The primary and secondary colors can be set using the `REACT_APP_THEME_PRIMARY_COLOR` and `REACT_APP_THEME_SECONDARY_COLOR` environment variables. These should be set to a valid CSS color value.
55+
56+
The app has a default logo shown below, but it can be customized by replacing the necessary files.
57+
58+
<img src='./static/meta/icon-512.png' alt='STAC Manager Logo' width='100px' />
59+
60+
The logo should be a square image with a size of 512x512 pixels and should be placed in the `static/meta` folder with the name `icon-512.png`.
61+
62+
To ensure the branding is consistent, the remaining meta images (in the `static/meta` folder) should also be replaced:
63+
```
64+
icon-192.png 192x192
65+
icon-512.png 512x512
66+
favicon.png 32x32
67+
apple-touch-icon.png 360x360
68+
meta-image.png 1920x1080
69+
```

packages/client/posthtml.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
locals: {
2929
appTitle: process.env.APP_TITLE,
3030
appDescription: process.env.APP_DESCRIPTION,
31-
baseurl: process.env.PUBLIC_URL || ''
31+
baseurl: process.env.PUBLIC_URL || '/'
3232
}
3333
}
3434
}

packages/client/src/App.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
Text,
88
Badge,
99
Divider,
10-
Fade
10+
Fade,
11+
Image
1112
} from '@chakra-ui/react';
1213
import { keyframes } from '@emotion/react';
1314
import { Route, Routes } from 'react-router-dom';
@@ -86,9 +87,23 @@ export function App() {
8687
justifyContent='space-between'
8788
py={8}
8889
>
89-
<Heading as='p' size='sm'>
90-
STAC Manager
91-
</Heading>
90+
<Flex gap={4} alignItems='center'>
91+
<Image
92+
src={`${process.env.PUBLIC_URL || ''}/meta/icon-512.png`}
93+
width={8}
94+
aspectRatio={1}
95+
borderRadius='md'
96+
/>
97+
<Divider
98+
orientation='vertical'
99+
borderColor='base.200a'
100+
h='1rem'
101+
borderLeftWidth='2px'
102+
/>
103+
<Heading as='p' size='sm'>
104+
STAC Manager
105+
</Heading>
106+
</Flex>
92107

93108
<MainNavigation />
94109
</Flex>

packages/client/src/components/ItemCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ import {
1515
SkeletonText
1616
} from '@chakra-ui/react';
1717
import SmartLink from './SmartLink';
18+
import { ItemCardThumbPlaceholder } from './ItemCardThumbPlaceholder';
1819

1920
interface ItemCardProps {
2021
imageSrc?: string;
2122
imageAlt?: string;
23+
showPlaceholder?: boolean;
2224
title?: string;
2325
subtitle?: string;
2426
description?: string;
@@ -30,6 +32,7 @@ interface ItemCardProps {
3032
export function ItemCard({
3133
imageSrc,
3234
imageAlt,
35+
showPlaceholder,
3336
title,
3437
subtitle,
3538
description,
@@ -47,19 +50,22 @@ export function ItemCard({
4750
);
4851
};
4952

53+
const shouldUsePlaceholder = showPlaceholder && !imageSrc;
54+
5055
return (
5156
<Card as='article' variant='filled'>
5257
{imageSrc &&
5358
renderLink(
5459
<Image
5560
src={imageSrc}
5661
alt={imageAlt}
57-
height='16rem'
5862
width='100%'
63+
aspectRatio={2}
5964
objectFit='cover'
6065
borderRadius='md'
6166
/>
6267
)}
68+
{shouldUsePlaceholder && renderLink(<ItemCardThumbPlaceholder />)}
6369
<CardHeader as='header'>
6470
<Flex direction='row' gap={4}>
6571
{(title || subtitle) && (

0 commit comments

Comments
 (0)