Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

feat: view snippet/cookbooks, bug fixes and general improvements #6

Merged
merged 59 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ea456a3
chore: update from old codiga package to the new one
dastrong-codiga Aug 31, 2022
b3c5785
feat: pass darwin check
dastrong-codiga Aug 31, 2022
c4f288c
fix: unmaximize window is already maximized
dastrong-codiga Aug 31, 2022
a966119
fix: uploaded clearer icon file
dastrong-codiga Aug 31, 2022
181affb
fix: extended window type
dastrong-codiga Aug 31, 2022
5feb8bf
fix: added mac style window options and added connecting text for off…
dastrong-codiga Aug 31, 2022
455d071
fix: added hover style
dastrong-codiga Sep 1, 2022
5c04dd2
fix: correct tag variables
dastrong-codiga Sep 1, 2022
1702fb1
fix: disable favorite BUTTON if not logged in
dastrong-codiga Sep 1, 2022
fb27b60
chore: reduced debounce
dastrong-codiga Sep 1, 2022
0665b42
chore: added apollo devtools
dastrong-codiga Sep 1, 2022
d9cbd6b
feat: created a hook to grab and organize query variables
dastrong-codiga Sep 1, 2022
422684f
fix: updated pages to use new hook
dastrong-codiga Sep 1, 2022
1018083
fix: updated favoriting refetch logic
dastrong-codiga Sep 1, 2022
5d6be3d
chore: added hover effect to favorite button
dastrong-codiga Sep 1, 2022
ca71283
fix: typo
dastrong-codiga Sep 1, 2022
158e154
feat: added boolean to know if filters are all empty/unused
dastrong-codiga Sep 1, 2022
48f8798
chore: reorganized empty states to use new isEmpty boolean
dastrong-codiga Sep 1, 2022
c804674
chore: removed additional unneeded filtering
dastrong-codiga Sep 1, 2022
01668eb
fix: restrict filtering when not logged in
dastrong-codiga Sep 1, 2022
753a787
chore: removed unused hook
dastrong-codiga Sep 1, 2022
a748778
fix: added checks for obscure public/private mismatch
dastrong-codiga Sep 1, 2022
94b6733
fix: added check for tests
dastrong-codiga Sep 1, 2022
e6b963d
chore: don't fetch recipe votes data if it's not in view
dastrong-codiga Sep 1, 2022
58a5f9a
chore: improve overlapping code actions/content
dastrong-codiga Sep 1, 2022
6fe2383
chore: made login a form to submit on enter in input
dastrong-codiga Sep 1, 2022
8a71d1e
chore: updated positioning of scrollbars
dastrong-codiga Sep 1, 2022
88b3baf
feat: added pollInterval for page queries
dastrong-codiga Sep 1, 2022
fff837b
chore: updated page queries to use pollInterval
dastrong-codiga Sep 1, 2022
be84609
chore: increased debounce timeout
dastrong-codiga Sep 1, 2022
819649a
chore: made some reusable components
dastrong-codiga Sep 2, 2022
37247c8
fix: remove boxShadow focus on anchors
dastrong-codiga Sep 2, 2022
2d1c829
chore: updated table to use reusable components
dastrong-codiga Sep 2, 2022
e1273c3
fix: corrected naming
dastrong-codiga Sep 2, 2022
90a278d
feat: added error/loading states for viewing a snippet
dastrong-codiga Sep 2, 2022
77e71f8
chore: updated eslint and ignored underscrore
dastrong-codiga Sep 2, 2022
78dd08c
chore: pulled Votes into its own folder
dastrong-codiga Sep 2, 2022
bdf3bd4
chore: put Code components into their own folder
dastrong-codiga Sep 2, 2022
0028045
chore: add two view queries
dastrong-codiga Sep 2, 2022
cd03630
chore: renamed files for reusability
dastrong-codiga Sep 2, 2022
abf0a67
fix: removed focused boxShadow
dastrong-codiga Sep 2, 2022
ba25ebb
fix: improved borders and added links to snippet/cookbook view page
dastrong-codiga Sep 2, 2022
0a59926
feat: created empty/error/loading states for snippet/cookbook view pages
dastrong-codiga Sep 2, 2022
d0389a7
chore: updated home page to use renamed files
dastrong-codiga Sep 2, 2022
143c058
feat: added snippet/cookbook view pages
dastrong-codiga Sep 2, 2022
01ed20e
chore: added two new routes and restructured how filters are shown
dastrong-codiga Sep 2, 2022
3e408b0
fix: corrected eslint config
dastrong-codiga Sep 2, 2022
4fb5cc9
fix: turned imports from absolute to relative
dastrong-codiga Sep 2, 2022
0bc86ca
chore: updated snippet/cookbook url utils
dastrong-codiga Sep 2, 2022
ac77eed
chore: removed page props
dastrong-codiga Sep 2, 2022
ff7d9ba
feat: made snippet/cookbook tables properly clickable
dastrong-codiga Sep 2, 2022
c8bc0e2
feat: updated search list item nested links
dastrong-codiga Sep 2, 2022
db6230a
fix: border position
dastrong-codiga Sep 2, 2022
e219d04
fix: updated link focus
dastrong-codiga Sep 2, 2022
b28ed55
feat: added search and improved loading structure
dastrong-codiga Sep 2, 2022
f3df6be
feat: added empty filtered states
dastrong-codiga Sep 2, 2022
e930764
feat: added more dropdown and edit snippet button
dastrong-codiga Sep 2, 2022
28b83c2
fix: focused shadow placement
dastrong-codiga Sep 2, 2022
708d63d
chore: made base font-size 14 to remain consistent
dastrong-codiga Sep 2, 2022
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
22 changes: 19 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,30 @@ module.exports = {
// A temporary hack related to IDE not resolving correct package.json
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'error',
'import/no-cycle': 'off',
'import/prefer-default-export': 'off',
// Since React 17 and typescript 4.1 you can safely disable the rule
'react/react-in-jsx-scope': 'off',
'react/jsx-props-no-spreading': 'off',
'import/no-cycle': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'react/require-default-props': [2, { functions: 'defaultArguments' }],
'import/prefer-default-export': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/naming-convention': [
'error',
{
format: null,
selector: 'variable',
leadingUnderscore: 'allow',
},
],
},
parserOptions: {
ecmaVersion: 2020,
Expand Down
Binary file modified assets/icon.icns
Binary file not shown.
Binary file modified assets/icon.ico
Binary file not shown.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@apollo/client": "^3.6.9",
"@chakra-ui/icons": "^1.1.7",
"@chakra-ui/react": "^1.8.8",
"@codiga/codiga-components": "^1.0.5",
"@codiga/components": "^1.1.0",
"@electron/remote": "^2.0.8",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
Expand Down
8 changes: 6 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (isDebug) {
const installExtensions = async () => {
const installer = require('electron-devtools-installer');
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
const extensions = ['REACT_DEVELOPER_TOOLS'];
const extensions = ['REACT_DEVELOPER_TOOLS', 'APOLLO_DEVELOPER_TOOLS'];

return installer
.default(
Expand Down Expand Up @@ -140,7 +140,11 @@ app
mainWindow?.minimize();
});
ipcMain.on('maximizeApp', () => {
mainWindow?.maximize();
if (mainWindow?.isMaximized()) {
mainWindow?.unmaximize();
} else {
mainWindow?.maximize();
}
});
ipcMain.on('closeApp', () => {
mainWindow?.close();
Expand Down
1 change: 1 addition & 0 deletions src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Channels =
| 'closeApp';

contextBridge.exposeInMainWorld('electron', {
isMac: process.platform === 'darwin',
ipcRenderer: {
sendMessage(channel: Channels, args: unknown[]) {
ipcRenderer.send(channel, args);
Expand Down
49 changes: 31 additions & 18 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloProvider } from '@apollo/client';
import { ChakraProvider } from '@chakra-ui/react';
import { theme } from '@codiga/codiga-components';
import { theme } from '@codiga/components';
import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';

// PAGES
Expand All @@ -24,37 +24,50 @@ import Filters from './components/Filters/Filters';
import { UserProvider } from './components/UserContext';
import { ThemeProvider } from './components/ThemeContext';
import { FiltersProvider } from './components/FiltersContext';
import ViewSnippet from './pages/ViewSnippet';
import ViewCookbookSnippets from './pages/ViewCookbookSnippets';

export default function App() {
return (
<ApolloProvider client={client}>
<ChakraProvider theme={theme}>
<UserProvider>
<ThemeProvider>
<Router>
<Layout>
<FiltersProvider>
<Filters />

<FiltersProvider>
<Router>
<Layout>
<Routes>
<Route path="/" element={<Home />} />
<Route element={<Filters />}>
<Route path="/" element={<Home />} />
<Route path="/my-snippets" element={<MySnippets />} />
<Route
path="/favorite-snippets"
element={<FavoriteSnippets />}
/>
<Route path="/my-cookbooks" element={<MyCookbooks />} />
<Route
path="/favorite-cookbooks"
element={<FavoriteCookbooks />}
/>
<Route path="/team-snippets" element={<TeamSnippets />} />
<Route
path="/team-cookbooks"
element={<TeamCookbooks />}
/>
</Route>

<Route path="/my-snippets" element={<MySnippets />} />
<Route
path="/favorite-snippets"
element={<FavoriteSnippets />}
path="/view-snippet/:snippetId"
element={<ViewSnippet />}
/>
<Route path="/my-cookbooks" element={<MyCookbooks />} />
<Route
path="/favorite-cookbooks"
element={<FavoriteCookbooks />}
path="/view-cookbook/:cookbookId"
element={<ViewCookbookSnippets />}
/>
<Route path="/team-snippets" element={<TeamSnippets />} />
<Route path="/team-cookbooks" element={<TeamCookbooks />} />
</Routes>
</FiltersProvider>
</Layout>
</Router>
</Layout>
</Router>
</FiltersProvider>
</ThemeProvider>
</UserProvider>
</ChakraProvider>
Expand Down
30 changes: 30 additions & 0 deletions src/renderer/components/AvatarAndName/AvatarAndName.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Flex, Text } from '@chakra-ui/react';
import { Avatar } from '@codiga/components';
import { PublicUser } from '../../types/userTypes';
import { getAvatarUrl } from '../../utils/userUtils';
import UserLink from '../UserLink';

type AvatarAndNameProps = {
owner?: PublicUser;
};

export default function AvatarAndName({ owner = {} }: AvatarAndNameProps) {
return (
<Flex alignItems="center" gap="space_8">
<Avatar
size="xs"
name={owner?.displayName || 'Anonymous'}
src={getAvatarUrl({ id: owner?.id })}
/>
<Text
size="xs"
noOfLines={1}
maxW="300px"
display="inline-block"
whiteSpace="nowrap"
>
<UserLink owner={owner} />
</Text>
</Flex>
);
}
1 change: 1 addition & 0 deletions src/renderer/components/AvatarAndName/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './AvatarAndName';
22 changes: 22 additions & 0 deletions src/renderer/components/BackButton/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { IconButton } from '@chakra-ui/react';
import { ChevronLeftIcon } from '@codiga/components';
import { useNavigate } from 'react-router-dom';

export default function BackButton() {
const navigate = useNavigate();

return (
<IconButton
variant="ghost"
onClick={() => navigate(-1)}
h="28px"
minW="28px"
fontSize="12px"
icon={<ChevronLeftIcon />}
aria-label="go back"
_focus={{
boxShadow: 'none',
}}
/>
);
}
1 change: 1 addition & 0 deletions src/renderer/components/BackButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './BackButton';
Loading