Skip to content

Commit

Permalink
Update Trove & Lexicon app IDs to os-X
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbroman committed Jul 12, 2023
1 parent 72ccdaf commit 94ab26f
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 198 deletions.
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 @@ -62,6 +62,9 @@ export const TitlebarByType = ({
);

if (appWindow.type === 'native') {
console.log('');
console.log('appWindow.appId', appWindow.appId);
console.log('');
hideTitlebarBorder = Boolean(
nativeApps[appWindow.appId].native?.hideTitlebarBorder
);
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"
]
}
}
16 changes: 7 additions & 9 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.4.3",
"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"
}
}
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
17 changes: 8 additions & 9 deletions trove/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,29 @@
"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"
}
}
12 changes: 9 additions & 3 deletions trove/src/Trove.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,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 +27,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 +52,27 @@ 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(() => {
//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 +81,7 @@ export const Trove = ({
}, [selectedSpace]);

if (!space) return null;

return (
<main
style={{
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
11 changes: 11 additions & 0 deletions trove/src/store/troveActions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { log, splitLastOccurrence } from '../helpers';
import useTroveStore from './troveStore';

const moveFileAction = async (fileId: string, toPath: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand Down Expand Up @@ -36,6 +37,7 @@ const moveFileAction = async (fileId: string, toPath: string) => {
log('error ', e);
}
};

const removeFileAction = async (fileId: string) => {
//look up the parent of the file id
const state = useTroveStore.getState();
Expand Down Expand Up @@ -70,6 +72,7 @@ const removeFileAction = async (fileId: string) => {
log('error ', e);
}
};

const addFileAction = async (metadata: any) => {
const state = useTroveStore.getState();
const api = state.api;
Expand Down Expand Up @@ -109,6 +112,7 @@ const addFileAction = async (metadata: any) => {
metadata.key
);
};

const removeFolderAction = async (pathToFolder: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -126,6 +130,7 @@ const removeFolderAction = async (pathToFolder: string) => {
log('error ', e);
}
};

const removeTroveAction = async (troveName: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -138,6 +143,7 @@ const removeTroveAction = async (troveName: string) => {
log('error ', e);
}
};

const editTroveAction = async (newTitle: string, trove: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -150,6 +156,7 @@ const editTroveAction = async (newTitle: string, trove: string) => {
log('error ', e);
}
};

const repermTroveAction = async (troveName: string, perms: any) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -162,6 +169,7 @@ const repermTroveAction = async (troveName: string, perms: any) => {
log('error ', e);
}
};

const moveFolderAction = async (fromPath: string, toPath: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -188,6 +196,7 @@ const moveFolderAction = async (fromPath: string, toPath: string) => {
log('error ', e);
}
};

const editFolderAction = async (fromPath: string, newName: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand All @@ -208,6 +217,7 @@ const editFolderAction = async (fromPath: string, newName: string) => {
log('error ', e);
}
};

const editFileAction = async (fileId: string, newTitle: string) => {
const state = useTroveStore.getState();
const api = state.api;
Expand Down Expand Up @@ -243,6 +253,7 @@ const editFileAction = async (fileId: string, newTitle: string) => {
log('error ', e);
}
};

export {
addFileAction,
editFileAction,
Expand Down
2 changes: 2 additions & 0 deletions trove/src/store/troveStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { trovePreload } from '../../../app/src/os/services/ship/trove.service';
import { Role } from '../types';

export type Folder = null | string;

type Node = null | {
id: string;
type: 'file' | 'folder';
};

export interface TroveStore {
api: null | typeof trovePreload;
setApi: (api: typeof trovePreload) => void;
Expand Down
Loading

0 comments on commit 94ab26f

Please sign in to comment.