-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from overthq/dashboard-features
More dashboard features
- Loading branch information
Showing
30 changed files
with
583 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
interface StoreCacheData { | ||
managers: string[]; | ||
} | ||
|
||
export default class CacheService { | ||
storeCache: Record<string, StoreCacheData>; | ||
|
||
public isStoreManager(storeId: string, userId: string) { | ||
return this.storeCache[storeId]?.managers.includes(userId) ?? false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import CacheService from './cache'; | ||
import EmailService from './email'; | ||
import NotificationsService from './notifications'; | ||
|
||
export default class Services { | ||
public notifications: NotificationsService; | ||
public email: EmailService; | ||
public cache: CacheService; | ||
|
||
constructor() { | ||
this.notifications = new NotificationsService(); | ||
this.email = new EmailService(); | ||
this.cache = new CacheService(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
apps/dashboard/src/components/filter-products/ProductCategories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { SelectGroup } from '@habiti/components'; | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
|
||
import { useCategoriesQuery } from '../../types/api'; | ||
|
||
// TODO: This should ultimately be stored in form state. | ||
|
||
const ProductCategories = () => { | ||
const [{ data, fetching }] = useCategoriesQuery(); | ||
const [selectedCategory, setSelectedCategory] = React.useState<string>(); | ||
|
||
if (fetching || !data) { | ||
return <View />; | ||
} | ||
|
||
return ( | ||
<SelectGroup | ||
selected={selectedCategory} | ||
onSelect={setSelectedCategory} | ||
options={data.currentStore.categories.map(c => ({ | ||
title: c.name, | ||
value: c.id | ||
}))} | ||
/> | ||
); | ||
}; | ||
|
||
export default ProductCategories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.