mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
tweak(marketplace): Tweak marketplace to match current fetching std
This commit is contained in:
1 parent
10639260e0
commit
5e225ca736
23 files changed
+148
-136
No files matched your search
@@ -1,11 +1,7 @@
|
||||
import { Box, Tooltip, Button } from '@material-ui/core';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
import React from 'react';
|
||||
import {
|
||||
MarketplaceActionResp,
|
||||
MarketplaceEvents,
|
||||
MarketplaceListing,
|
||||
} from '../../../../../../typings/marketplace';
|
||||
import { MarketplaceEvents, MarketplaceListing } from '../../../../../../typings/marketplace';
|
||||
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
|
||||
import DeleteIcon from '@material-ui/icons/Delete';
|
||||
import ReportIcon from '@material-ui/icons/Report';
|
||||
@@ -17,6 +13,7 @@ import { useHistory } from 'react-router';
|
||||
import { CallEvents } from '../../../../../../typings/call';
|
||||
import { fetchNui } from '../../../../utils/fetchNui';
|
||||
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
|
||||
import { ServerPromiseResp } from '../../../../../../typings/common';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
icon: {
|
||||
@@ -33,12 +30,12 @@ export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...list
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
const handleDeleteListing = () => {
|
||||
fetchNui<MarketplaceActionResp>(MarketplaceEvents.DELETE_LISTING, {
|
||||
fetchNui<ServerPromiseResp>(MarketplaceEvents.DELETE_LISTING, {
|
||||
id: listing.id,
|
||||
}).then(({ err, errMsg }) => {
|
||||
if (err) {
|
||||
}).then((resp) => {
|
||||
if (resp.status !== 'ok') {
|
||||
return addAlert({
|
||||
message: t(errMsg),
|
||||
message: t('APPS_MARKETPLACE_DELETE_LISTING_FAILED'),
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
@@ -51,12 +48,12 @@ export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...list
|
||||
};
|
||||
|
||||
const handleReportListing = () => {
|
||||
fetchNui<MarketplaceActionResp>(MarketplaceEvents.REPORT_LISTING, {
|
||||
fetchNui<ServerPromiseResp>(MarketplaceEvents.REPORT_LISTING, {
|
||||
listingId: listing.id,
|
||||
}).then(({ err, errMsg }) => {
|
||||
if (err) {
|
||||
}).then((resp) => {
|
||||
if (resp.status !== 'ok') {
|
||||
return addAlert({
|
||||
message: t(errMsg),
|
||||
message: t('APPS_MARKETPLACE_REPORT_LISTING_FAILED'),
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import React from 'react';
|
||||
import { MarketplaceList } from './MarketplaceList';
|
||||
import { Box, CircularProgress } from '@material-ui/core';
|
||||
|
||||
const LoadingListings: React.FC = () => (
|
||||
<Box display="flex" flexGrow={1} width="100%" justifyContent="center" alignItems="center">
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
import { LoadingSpinner } from '../../../../ui/components/LoadingSpinner';
|
||||
|
||||
export const MarketplaceListContainer: React.FC = () => {
|
||||
return (
|
||||
<React.Suspense fallback={<LoadingListings />}>
|
||||
<React.Suspense fallback={<LoadingSpinner />}>
|
||||
<MarketplaceList />
|
||||
</React.Suspense>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user