chore: IDB_CONNECTION_READY action

This commit is contained in:
Anoop M D 2022-02-03 23:25:38 +05:30
parent 87907eeb53
commit ac7d5c04a3
4 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import React from 'react';
import { IconCode, IconStack, IconGitPullRequest, IconUser, IconUsers, IconSettings, IconLayoutGrid } from '@tabler/icons';
import { IconCode, IconStack, IconGitPullRequest, IconUser, IconUsers, IconSettings, IconLayoutGrid, IconBuilding } from '@tabler/icons';
import StyledWrapper from './StyledWrapper';
const MenuBar = () => {
@ -23,6 +23,10 @@ const MenuBar = () => {
</div>
</div>
<div className="flex flex-col flex-grow justify-end">
{/* Teams Icon */}
{/* <div className="menu-item">
<IconBuilding size={28} strokeWidth={1.5}/>
</div> */}
<div className="menu-item">
<IconUser size={28} strokeWidth={1.5}/>
</div>

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useEffect } from 'react';
import Mousetrap from 'mousetrap';
export const HotkeysContext = React.createContext();
@ -17,7 +17,7 @@ export const HotkeysProvider = props => {
}, []);
return (
<HotkeysContext.Provider {...props}>
<HotkeysContext.Provider {...props} value='hotkey'>
{props.children}
</HotkeysContext.Provider>
);

View File

@ -1,12 +1,11 @@
import React, { useEffect, useContext, useReducer, createContext } from 'react';
import reducer from './reducer';
import useIdb from './useIdb';
import { sendRequest } from '../../network';
import { nanoid } from 'nanoid';
export const StoreContext = createContext();
const tabId1 = nanoid();
const collection = {
"id": nanoid(),
"name": "spacex",
@ -112,6 +111,7 @@ const collection2 = {
};
const initialState = {
idbConnection: null,
collections: [collection, collection2],
activeRequestTabId: null,
requestQueuedToSend: null,
@ -132,6 +132,8 @@ export const StoreProvider = props => {
}
}, [state.requestQueuedToSend]);
useIdb(dispatch);
return <StoreContext.Provider value={[state, dispatch]} {...props} />;
};

View File

@ -15,6 +15,14 @@ import {
const reducer = (state, action) => {
switch (action.type) {
case actions.IDB_CONNECTION_READY: {
return produce(state, (draft) => {
draft.idbConnection = action.connection;
console.log("here");
});
}
case actions.SIDEBAR_COLLECTION_CLICK: {
return produce(state, (draft) => {
const collection = find(draft.collections, (c) => c.id === action.id);