Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blank Trove & Lexicon #1900

Merged
merged 3 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/src/os/services/ship/spaces/bazaar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ export class BazaarService extends AbstractService<BazaarUpdateType> {
}

async init() {
//refresh app catalog
await APIConnection.getInstance().conduit.poke({
app: 'bazaar',
mark: 'bazaar-action',
json: { initialize: null },
});
return new Promise((resolve, reject) => {
APIConnection.getInstance().conduit.watch({
app: 'bazaar',
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/apps/nativeApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const nativeApps: AppManifestMap = {
hideTitlebarBorder: true,
},
},
lexicon: {
'os-lexicon': {
id: 'os-lexicon',
title: 'Lexicon',
type: 'native',
Expand All @@ -70,7 +70,7 @@ export const nativeApps: AppManifestMap = {
hideTitlebarBorder: true,
},
},
trove: {
'os-trove': {
id: 'os-trove',
title: 'Trove',
type: 'native',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { TroveApp } from 'renderer/apps/Trove/TroveApp';
export enum NativeAppId {
Browser = 'os-browser',
Settings = 'os-settings',
Lexicon = 'lexicon',
Trove = 'trove',
Lexicon = 'os-lexicon',
Trove = 'os-trove',
}

export const getNativeAppWindow = {
Expand All @@ -25,11 +25,11 @@ export const getNativeAppWindow = {
titlebar: null,
view: (props: any) => <SystemApp {...props} />,
},
lexicon: {
'os-lexicon': {
titlebar: null,
view: (props: any) => <LexiconApp {...props} />,
},
trove: {
'os-trove': {
titlebar: null,
view: (props: any) => <TroveApp {...props} />,
},
Expand Down
17 changes: 14 additions & 3 deletions lexicon/.babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", {"runtime": "automatic"}],
["@babel/preset-typescript", { "isTSX": true, "allExtensions": true }]
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
[
"@babel/preset-typescript",
{
"isTSX": true,
"allExtensions": true
}
]
],
"plugins": [
"babel-plugin-styled-components",
"@babel/plugin-proposal-class-properties"
]
}
}
18 changes: 8 additions & 10 deletions lexicon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,25 @@
},
"dependencies": {
"@urbit/http-api": "^2.3.0",
"react-router-dom": "^6.12.0",
"react-router-dom": "^6.14.1",
"zustand": "^4.3.8"
},
"peerDependencies": {
"@holium/design-system": "0.2.1",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.6"
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@preconstruct/cli": "^2.2.1",
"@preconstruct/cli": "^2.2.2",
"@types/babel__core": "^7.1.20",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"eslint": "^8.38.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"typescript": "^5.0.2"
"babel-loader": "^8.3.0",
"babel-plugin-styled-components": "^2.0.7"
}
}
}
69 changes: 38 additions & 31 deletions lexicon/src/Lexicon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { useEffect } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import {
BrowserRouter,
Navigate,
redirect,
Route,
Routes,
} from 'react-router-dom';
import { createGlobalStyle } from 'styled-components';

import {
Expand Down Expand Up @@ -28,6 +34,7 @@ const GlobalStyle = createGlobalStyle`
outline: none;
}
`;

declare global {
interface Window {
ship: string;
Expand Down Expand Up @@ -296,37 +303,37 @@ export const Lexicon = ({
useEffect(() => {
setShipName(shipName);
}, [shipName]);

useEffect(() => {
// Start at the root path.
redirect('/');
}, []);

if (!api) return null;

return (
<>
<main
style={{
overflowY: 'auto',
height: '100vh',
backgroundColor: 'transparent',
}}
>
<GlobalStyle />
<Router>
<Routes>
<Route element={<Navigation selectedSpace={selectedSpace} />}>
<Route
path="/index.html/:ship/:group/:word"
element={<WordPage />}
/>
<Route path="/index.html/:ship/:group" element={<HomePage />} />
<Route
path="/index.html/dict/:word"
element={<DictionaryPage />}
/>
<Route
path="/index.html"
element={<p>don't mind me just redirecting over here</p>}
/>
</Route>
</Routes>
</Router>
</main>
</>
<main
style={{
overflowY: 'auto',
height: '100vh',
backgroundColor: 'transparent',
}}
>
<GlobalStyle />
<BrowserRouter>
<Routes>
<Route element={<Navigation selectedSpace={selectedSpace} />}>
<Route path="/:ship/:group/:word" element={<WordPage />} />
<Route path="/:ship/:group" element={<HomePage />} />
<Route path="/dict/:word" element={<DictionaryPage />} />
<Route
path="/"
element={<p>don't mind me just redirecting over here</p>}
/>
</Route>
</Routes>
<Navigate to={selectedSpace} />
</BrowserRouter>
</main>
);
};
2 changes: 1 addition & 1 deletion lib/design-system/src/os/AppTile/AppTile.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
} as ComponentMeta<typeof AppTile>;

const lexicon: AppTileType = {
id: 'lexicon',
id: 'os-lexicon',
title: 'Lexicon',
href: {
glob: {
Expand Down
19 changes: 9 additions & 10 deletions trove/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,34 @@
"mime": "^3.0.0",
"moment": "^2.29.4",
"react-dnd-html5-backend": "^16.0.1",
"react-router-dom": "^6.4.3",
"react-router-dom": "^6.14.1",
"styled-components": "^5.3.6",
"styled-system": "^5.1.5",
"urbit-ob": "^5.0.1",
"yet-another-react-lightbox": "^2.3.0",
"zustand": "^4.1.4",
"zustand": "^4.3.8",
"react-dnd": "^16.0.1"
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@preconstruct/cli": "^2.2.1",
"@preconstruct/cli": "^2.2.2",
"@types/babel__core": "^7.1.20",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"eslint": "^8.38.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"typescript": "^5.0.2",
"@types/styled-components": "^5.1.26",
"@types/styled-system": "^5.1.15",
"@urbit/vite-plugin-urbit": "^0.8.0",
"@vitejs/plugin-react-refresh": "^1.3.1",
"autoprefixer": "^10.3.7",
"babel-loader": "^8.3.0",
"babel-plugin-styled-components": "^2.0.7",
"postcss": "^8.3.9",
"react-icons": "^4.6.0",
"tailwindcss": "^2.2.16",
"vite": "^2.9.16",
"vite": "^4.3.9",
"urbit-ob": "^5.0.1"
}
}
34 changes: 26 additions & 8 deletions trove/src/Trove.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { useEffect } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import {
BrowserRouter,
Navigate,
redirect,
Route,
Routes,
} from 'react-router-dom';
import { createTheme, ThemeProvider } from '@mui/material/styles';

import { trovePreload } from '../../app/src/os/services/ship/trove.service';
Expand All @@ -8,12 +14,12 @@ import { Navigation } from './components';
import { Home } from './pages';
import useTroveStore, { TroveStore } from './store/troveStore';
import { theme } from './theme';

const muiTheme = createTheme({
palette: {
primary: { main: theme.primary },
error: { main: theme.error },
},

typography: {
fontFamily: ['Rubik'].join(','),
subtitle1: {
Expand All @@ -27,15 +33,16 @@ const muiTheme = createTheme({
},
},
});
interface Props {

type Props = {
selectedSpace: string;
shipName: string;
TroveIPC: typeof trovePreload;
update: any;
useStorage: any;
uploadFile: any;
deleteFile: any;
}
};

export const Trove = ({
selectedSpace,
Expand All @@ -51,23 +58,32 @@ export const Trove = ({
const setSpace = useTroveStore((store: TroveStore) => store.setSpace);
const space = useTroveStore((store: TroveStore) => store.space);
const setApi = useTroveStore((store: TroveStore) => store.setApi);

useEffect(() => {
// Start at the root path.
redirect('/');
}, []);

useEffect(() => {
//subscribe to updates here
TroveIPC.UIUpdates();
//add our api instance to the store
setApi(TroveIPC);
}, [TroveIPC]);

useEffect(() => {
if (update) {
updateHandler(update);
}
}, [update]);

useEffect(() => {
if (shipName) {
setShipName(shipName);
setMySpace(shipName + '/our');
}
}, [shipName]);

useEffect(() => {
if (selectedSpace) {
const newSpace = selectedSpace.substring(1);
Expand All @@ -76,6 +92,7 @@ export const Trove = ({
}, [selectedSpace]);

if (!space) return null;

return (
<main
style={{
Expand All @@ -84,11 +101,11 @@ export const Trove = ({
}}
>
<ThemeProvider theme={muiTheme}>
<Router>
<BrowserRouter>
<Routes>
<Route element={<Navigation selectedSpace={selectedSpace} />}>
<Route
path="index.html/:ship/:group"
path="/:ship/:group"
element={
<Home
useStorage={useStorage}
Expand All @@ -98,14 +115,15 @@ export const Trove = ({
}
/>
<Route
path="index.html/"
path="/"
element={
<>Enter a space in the url example: ...apps/trove/~zod/our</>
}
/>
</Route>
</Routes>
</Router>
<Navigate to={selectedSpace} />
</BrowserRouter>
</ThemeProvider>
</main>
);
Expand Down
1 change: 1 addition & 0 deletions trove/src/components/NavigationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { WrappedBackground } from '../components';
import { splitLastOccurrence } from '../helpers';
import useTroveStore, { TroveStore } from '../store/troveStore';
import { theme } from '../theme';

export const NavigationHeader = () => {
const currentSpace = useTroveStore((store: TroveStore) => store.currentSpace);
const [stlfDisplay, setStflDisplay] = useState<string>('');
Expand Down
1 change: 1 addition & 0 deletions trove/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export const Home = ({ useStorage, uploadFile, deleteFile }: any) => {
useEffect(() => {
getTroves();
}, [space]);

const getPerm = (
permObj: any,
troveName: string
Expand Down
Loading