Skip to content

Commit

Permalink
Update base path only for github page
Browse files Browse the repository at this point in the history
  • Loading branch information
glanzz committed May 13, 2024
1 parent ac7acae commit 0a92de0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploysite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
run: npm run buildgit
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
Expand Down
1 change: 1 addition & 0 deletions app/great-green/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"buildgit": "vite build --base=/great-green",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"pwa-assets": "pwa-assets-generator --preset minimal-2023 public/logo.svg"
Expand Down
11 changes: 8 additions & 3 deletions app/great-green/src/components/landing-page/about_us.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import { useTranslation } from "react-i18next";
//internalization


const AboutCard = () => (

const AboutCard = () => {
let base = "/"
if (window.location.href.indexOf("great-green") === -1) {
base = "/great-green/"
}
return (
<div style={{padding: "40px", border: 0, display: "flex", flexWrap: "wrap", justifyContent: "space-between", color: "white"}} >
<div style={{zIndex: 999}}>
<div className='about_head'>{t('aboutus.title')}</div>
Expand All @@ -19,11 +23,12 @@ const AboutCard = () => (
</div>
</div>
<Avatar alt="Remy Sharp"
src="/great green wall.jpeg"
src={base + "great green wall.jpeg"}
sx={{ width: "300px", height: "300px", zIndex: 999 }}
/>
</div>
);
}

//interacting animation
const InteractiveComponent: React.FC = () => {
Expand Down
3 changes: 2 additions & 1 deletion app/great-green/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import HttpApi from 'i18next-http-backend';

const base = import.meta.env.BASE_URL || "";
i18n.use(HttpApi)
.use(initReactI18next)
.init({
lng:'en',
fallbackLng: 'en',
ns: ['common'],
backend: {
loadPath:'/i18n/{{lng}}/{{ns}}.json'
loadPath: base + '/i18n/{{lng}}/{{ns}}.json'
},
interpolation: {
escapeValue:false
Expand Down
4 changes: 2 additions & 2 deletions app/great-green/src/pages/GithubHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function GithubPage() {
<div className="background">
<div
style={{
backgroundImage: `url('/background.png')`,
backgroundImage: `url('/great-green/background.png')`,
backgroundSize: "cover",
height: "100vh",
}}
Expand All @@ -150,7 +150,7 @@ function GithubPage() {
<div></div>
<div>
<div className="title">
<img src="/logowhite.png" width={100} alt="logo" />
<img src="/great-green/logowhite.png" width={100} alt="logo" />
</div>
<div className="info">
{t("landing.content.label1")}
Expand Down
1 change: 0 additions & 1 deletion app/great-green/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { VitePWA } from "vite-plugin-pwa";

// https://vitejs.dev/config/
export default defineConfig({
base: "/great-green",
plugins: [
react(),
VitePWA({
Expand Down

0 comments on commit 0a92de0

Please sign in to comment.