Skip to content

Commit

Permalink
Merge pull request #3 from brunoportela/sql-mongo-icon
Browse files Browse the repository at this point in the history
Fix card info display - DB icons and Timestamp
  • Loading branch information
J-DannyMartinez authored Apr 20, 2021
2 parents 6398f46 + ee1ba38 commit 72334ba
Show file tree
Hide file tree
Showing 4 changed files with 572 additions and 568 deletions.
10 changes: 7 additions & 3 deletions app/components/Occupied.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const Occupied = React.memo(() => {
</div>
{applications.filter((db: any) => db[0].toLowerCase().includes(searchTerm.toLowerCase()))
.map((app: string[], i: number | any | string | undefined) => (
<div className="card" key={`card-${i}`} id={`card-${i}`}>
<div className="card" key={`card-${i}`} id={`card-${app[1]}`}>
<Card
key={`card-${i}`}
className={classes.paper}
Expand All @@ -243,7 +243,11 @@ const Occupied = React.memo(() => {

<div className="databaseIconContainer">
<div className="databaseIconHeader">
<img className="databaseIcon" src="../assets/mongo-icon-white.png" alt="MongoDB"></img>
{
app[1] === "SQL" ?
<img className="databaseIcon" alt="SQL"/> :
<img className="databaseIcon" alt="MongoDB"/>
}
</div>
</div>

Expand Down Expand Up @@ -273,7 +277,7 @@ const Occupied = React.memo(() => {

<div className="cardFooter">
<UpdateIcon className="cardFooterIcon"/>
<em><p id="cardFooterText">Just updated</p></em>
<em><p id="cardFooterText">{app[3]}</p></em>
</div>
</Card>
</div>
Expand Down
17 changes: 8 additions & 9 deletions app/context/DashboardContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const DashboardContext = createContext<any>(null);

/**
* MANAGES THE FOLLOWING DATA AND ACTIONS:
* @property {Array} applications List of all applications, their description and creation date
* @property {Array} applications List of all applications, their description, database type and creation date
* @method getApplications
* @method addApp
* @method deleteApp
Expand All @@ -29,7 +29,7 @@ const DashboardContextProvider = React.memo(({ children }: Props) => {
/**
* Sends a request for all existing applications belonging to a user
* and sets the applications state to the list of app names
* Also sends a request for the previously saved theme/mode
* Also sends a request for the previously saved theme/mode
* and sets the mode state to the retrieved settings
*/
const getApplications = useCallback(() => {
Expand Down Expand Up @@ -61,22 +61,21 @@ const DashboardContextProvider = React.memo(({ children }: Props) => {
const result = ipcRenderer.sendSync('deleteApp', index);
setApplications(result);
}, []);

/**
* Sends a synchronous request to change the current mode/theme using a provided
* string. The string is use to locate the desired mode info in settings.json in
* the backend. Updates mode/theme.
*/

const changeMode = useCallback((currMode: string) => {
const result = ipcRenderer.sendSync(
'changeMode',
currMode
);
const result = ipcRenderer.sendSync('changeMode', currMode);
setMode(result);
}, [])
}, []);
return (
<DashboardContext.Provider value={{ applications, getApplications, addApp, deleteApp, mode, changeMode}}>
<DashboardContext.Provider
value={{ applications, getApplications, addApp, deleteApp, mode, changeMode }}
>
{children}
</DashboardContext.Provider>
);
Expand Down
Loading

0 comments on commit 72334ba

Please sign in to comment.