Skip to content

Commit 72334ba

Browse files
Merge pull request #3 from brunoportela/sql-mongo-icon
Fix card info display - DB icons and Timestamp
2 parents 6398f46 + ee1ba38 commit 72334ba

File tree

4 files changed

+572
-568
lines changed

4 files changed

+572
-568
lines changed

app/components/Occupied.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const Occupied = React.memo(() => {
233233
</div>
234234
{applications.filter((db: any) => db[0].toLowerCase().includes(searchTerm.toLowerCase()))
235235
.map((app: string[], i: number | any | string | undefined) => (
236-
<div className="card" key={`card-${i}`} id={`card-${i}`}>
236+
<div className="card" key={`card-${i}`} id={`card-${app[1]}`}>
237237
<Card
238238
key={`card-${i}`}
239239
className={classes.paper}
@@ -243,7 +243,11 @@ const Occupied = React.memo(() => {
243243

244244
<div className="databaseIconContainer">
245245
<div className="databaseIconHeader">
246-
<img className="databaseIcon" src="../assets/mongo-icon-white.png" alt="MongoDB"></img>
246+
{
247+
app[1] === "SQL" ?
248+
<img className="databaseIcon" alt="SQL"/> :
249+
<img className="databaseIcon" alt="MongoDB"/>
250+
}
247251
</div>
248252
</div>
249253

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

274278
<div className="cardFooter">
275279
<UpdateIcon className="cardFooterIcon"/>
276-
<em><p id="cardFooterText">Just updated</p></em>
280+
<em><p id="cardFooterText">{app[3]}</p></em>
277281
</div>
278282
</Card>
279283
</div>

app/context/DashboardContext.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const DashboardContext = createContext<any>(null);
1717

1818
/**
1919
* MANAGES THE FOLLOWING DATA AND ACTIONS:
20-
* @property {Array} applications List of all applications, their description and creation date
20+
* @property {Array} applications List of all applications, their description, database type and creation date
2121
* @method getApplications
2222
* @method addApp
2323
* @method deleteApp
@@ -29,7 +29,7 @@ const DashboardContextProvider = React.memo(({ children }: Props) => {
2929
/**
3030
* Sends a request for all existing applications belonging to a user
3131
* and sets the applications state to the list of app names
32-
* Also sends a request for the previously saved theme/mode
32+
* Also sends a request for the previously saved theme/mode
3333
* and sets the mode state to the retrieved settings
3434
*/
3535
const getApplications = useCallback(() => {
@@ -61,22 +61,21 @@ const DashboardContextProvider = React.memo(({ children }: Props) => {
6161
const result = ipcRenderer.sendSync('deleteApp', index);
6262
setApplications(result);
6363
}, []);
64-
64+
6565
/**
6666
* Sends a synchronous request to change the current mode/theme using a provided
6767
* string. The string is use to locate the desired mode info in settings.json in
6868
* the backend. Updates mode/theme.
6969
*/
7070

7171
const changeMode = useCallback((currMode: string) => {
72-
const result = ipcRenderer.sendSync(
73-
'changeMode',
74-
currMode
75-
);
72+
const result = ipcRenderer.sendSync('changeMode', currMode);
7673
setMode(result);
77-
}, [])
74+
}, []);
7875
return (
79-
<DashboardContext.Provider value={{ applications, getApplications, addApp, deleteApp, mode, changeMode}}>
76+
<DashboardContext.Provider
77+
value={{ applications, getApplications, addApp, deleteApp, mode, changeMode }}
78+
>
8079
{children}
8180
</DashboardContext.Provider>
8281
);

0 commit comments

Comments
 (0)