Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TasoOneAsia committed Dec 8, 2021
2 parents 7b185ad + ae9e828 commit 1e79092
Show file tree
Hide file tree
Showing 56 changed files with 349 additions and 347 deletions.
13 changes: 8 additions & 5 deletions import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ CREATE TABLE IF NOT EXISTS `npwd_marketplace_listings`

CREATE TABLE IF NOT EXISTS `npwd_marketplace_reports`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`listing_id` int(11) DEFAULT NULL,
`profile` varchar(255) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`listing_id` int(11) DEFAULT NULL,
`profile` varchar(255) DEFAULT NULL,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
PRIMARY KEY (id)
);

Expand Down Expand Up @@ -181,8 +184,8 @@ CREATE TABLE IF NOT EXISTS `npwd_calls`

CREATE TABLE IF NOT EXISTS npwd_phone_gallery
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`image` varchar(255) NOT NULL,
PRIMARY KEY (id),
INDEX `identifier` (`identifier`)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@octokit/core": "^3.5.1",
"husky": "^7.0.4",
"lerna": "^4.0.0",
"prettier": "^2.4.1",
"prettier": "^2.5.0",
"pretty-quick": "^3.1.2"
},
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions phone/src/apps/contacts/hooks/useContactsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export const useContactsAPI = () => {
}).then((serverResp) => {
if (serverResp.status !== 'ok') {
return addAlert({
message: t('CONTACTS.ADD_FAILED'),
message: t('CONTACTS.FEEDBACK.ADD_FAILED'),
type: 'error',
});
}

// Sanity checks maybe?
addLocalContact(serverResp.data);
addAlert({
message: t('CONTACTS.ADD_SUCCESS'),
message: t('CONTACTS.FEEDBACK.ADD_SUCCESS'),
type: 'success',
});
history.replace(referral);
Expand All @@ -49,7 +49,7 @@ export const useContactsAPI = () => {
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('CONTACTS.UPDATE_FAILED'),
message: t('CONTACTS.FEEDBACK.UPDATE_FAILED'),
type: 'error',
});
}
Expand All @@ -62,7 +62,7 @@ export const useContactsAPI = () => {
});

addAlert({
message: t('CONTACTS.UPDATE_SUCCESS'),
message: t('CONTACTS.FEEDBACK.UPDATE_SUCCESS'),
type: 'success',
});

Expand All @@ -77,7 +77,7 @@ export const useContactsAPI = () => {
fetchNui<ServerPromiseResp>(ContactEvents.DELETE_CONTACT, { id }).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('CONTACTS.DELETE_FAILED'),
message: t('CONTACTS.FEEDBACK.DELETE_FAILED'),
type: 'error',
});
}
Expand All @@ -86,7 +86,7 @@ export const useContactsAPI = () => {
deleteLocalContact(id);

addAlert({
message: t('CONTACTS.DELETE_SUCCESS'),
message: t('CONTACTS.FEEDBACK.DELETE_SUCCESS'),
type: 'success',
});
});
Expand Down
2 changes: 1 addition & 1 deletion phone/src/apps/dialer/components/DialerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const DialerInput: React.FC = () => {
return (
<Box component={Paper} className={classes.root}>
<InputBase
placeholder={t('APPS_DIALER_INPUT_PLACEHOLDER')}
placeholder={t('DIALER.INPUT_PLACEHOLDER')}
className={classes.input}
value={inputVal}
onChange={(e) => set(e.target.value)}
Expand Down
6 changes: 3 additions & 3 deletions phone/src/apps/dialer/components/DialerNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ const DialerNavBar: React.FC = () => {
return (
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
<BottomNavigationAction
label={t('APPS_DIALER_NAVBAR_HISTORY')}
label={t('DIALER.NAVBAR_HISTORY')}
value="/phone"
component={NavLink}
icon={<HistoryIcon />}
to="/phone"
/>
<BottomNavigationAction
label={t('APPS_DIALER_NAVBAR_DIAL')}
label={t('DIALER.NAVBAR_DIAL')}
value="/phone/dial"
color="secondary"
component={NavLink}
icon={<PhoneIcon />}
to="/phone/dial"
/>
<BottomNavigationAction
label={t('APPS_DIALER_NAVBAR_CONTACTS')}
label={t('DIALER.NAVBAR_CONTACTS')}
value="/phone/contacts"
color="secondary"
component={NavLink}
Expand Down
2 changes: 1 addition & 1 deletion phone/src/apps/dialer/components/views/DialerHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const DialerHistory: React.FC = () => {
return (
<Box display="flex" justifyContent="center" alignItems="center" paddingTop={35}>
<p>
{t('APPS_DIALER_NO_HISTORY')}
{t('DIALER.NO_HISTORY')}
<span role="img" aria-label="sad">
😞
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...list
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_MARKETPLACE_DELETE_LISTING_FAILED'),
message: t('MARKETPLACE.FEEDBACK.DELETE_LISTING_FAILED'),
type: 'error',
});
}

addAlert({
message: t('APPS_MARKETPLACE_DELETE_LISTING_SUCCESS'),
message: t('MARKETPLACE.FEEDBACK.DELETE_LISTING_SUCCESS'),
type: 'success',
});
});
Expand All @@ -54,13 +54,13 @@ export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...list
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_MARKETPLACE_REPORT_LISTING_FAILED'),
message: t('MARKETPLACE.FEEDBACK.REPORT_LISTING_FAILED'),
type: 'error',
});
}

addAlert({
message: t('APPS_MARKETPLACE_REPORT_LISTING_SUCCESS'),
message: t('MARKETPLACE.FEEDBACK.REPORT_LISTING_SUCCESS'),
type: 'success',
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const useStyles = makeStyles((theme) => ({
display: 'flex',
flexFlow: 'column',
alignItems: 'flex',
borderWidth: 2,
height: 'auto',
background: theme.palette.background.paper,
marginBottom: 20,
Expand Down
12 changes: 6 additions & 6 deletions phone/src/apps/marketplace/components/form/ListingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const ListingForm: React.FC = () => {
const addListing = () => {
if (!areFieldsFilled) {
return addAlert({
message: t('APPS_MARKETPLACE_REQUIRED_FIELDS'),
message: t('MARKETPLACE.FEEDBACK.REQUIRED_FIELDS'),
type: 'error',
});
}
Expand All @@ -78,13 +78,13 @@ export const ListingForm: React.FC = () => {
}

return addAlert({
message: t('APPS_MARKETPLACE_CREATE_LISTING_FAILED'),
message: t('MARKETPLACE.FEEDBACK.CREATE_LISTING_FAILED'),
type: 'error',
});
}

addAlert({
message: t('APPS_MARKETPLACE_CREATE_LISTING_SUCCESS'),
message: t('MARKETPLACE.FEEDBACK.CREATE_LISTING_SUCCESS'),
type: 'success',
});
history.push('/marketplace');
Expand Down Expand Up @@ -131,7 +131,7 @@ export const ListingForm: React.FC = () => {
error={title.length >= MarketplaceDatabaseLimits.title}
onChange={handleTitleChange}
label={t('GENERIC.REQUIRED')}
placeholder={t('APPS_MARKETPLACE_FORM_TITLE')}
placeholder={t('MARKETPLACE.FORM_TITLE')}
inputProps={{
className: classes.textFieldInput,
maxLength: 25,
Expand All @@ -153,7 +153,7 @@ export const ListingForm: React.FC = () => {
</Box>
<TextField
className={classes.input}
placeholder={t('APPS_MARKETPLACE_FORM_IMAGE')}
placeholder={t('MARKETPLACE.FORM_IMAGE')}
value={url}
error={url.length >= MarketplaceDatabaseLimits.url}
onChange={handleUrlChange}
Expand All @@ -168,7 +168,7 @@ export const ListingForm: React.FC = () => {
onChange={handleDescriptionChange}
label={t('GENERIC.REQUIRED')}
error={description.length >= MarketplaceDatabaseLimits.description}
placeholder={t('APPS_MARKETPLACE_FORM_DESCRIPTION')}
placeholder={t('MARKETPLACE.FORM_DESCRIPTION')}
inputProps={{
className: classes.multilineFieldInput,
maxLength: 130,
Expand Down
12 changes: 7 additions & 5 deletions phone/src/apps/marketplace/hooks/useMarketplaceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MarketplaceListing } from '@typings/marketplace';
import { useRecoilCallback } from 'recoil';

interface MarketplaceActionValues {
deleteListing: (id: number) => void;
deleteListing: (ids: number[]) => void;
addListing: (listing: MarketplaceListing) => void;
}

Expand All @@ -12,25 +12,27 @@ export const useMarketplaceActions = (): MarketplaceActionValues => {

const deleteListing = useRecoilCallback(
({ snapshot }) =>
(id: number) => {
(ids: number[]) => {
const { state, contents } = snapshot.getLoadable(listingState);
// Make sure our atom is actually loaded before we attempt a dispatch
if (state !== 'hasValue') return;
// Tts possible for the init fetch to fail and empty array is passed. In that case
// block dispatch
if (!contents.length) return;

setListings((curListings) => [...curListings].filter((listing) => listing.id !== id));
setListings((curListings) =>
[...curListings].filter((listing) => !ids.includes(listing.id)),
);
},
[],
);

const addListing = useRecoilCallback(
({ snapshot }) =>
(listing: MarketplaceListing) => {
const { contents } = snapshot.getLoadable(listingState);
const { state } = snapshot.getLoadable(listingState);
// Make sure our atom is actually loaded before we attempt a dispatch
if (contents !== 'hasValue') return;
if (state !== 'hasValue') return;

setListings((curListings) => [listing, ...curListings]);
},
Expand Down
16 changes: 4 additions & 12 deletions phone/src/apps/marketplace/hooks/useMarketplaceService.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { useNuiEvent } from 'fivem-nui-react-lib';
import {
MarketplaceBroadcastAddDTO,
MarketplaceDeleteDTO,
MarketplaceEvents,
} from '@typings/marketplace';
import { MarketplaceBroadcastAddDTO, MarketplaceEvents } from '@typings/marketplace';
import { useMarketplaceActions } from './useMarketplaceActions';
import { useCallback } from 'react';

Expand All @@ -18,8 +14,8 @@ export const useMarketplaceService = () => {
);

const deleteListingHandler = useCallback(
(listing: MarketplaceDeleteDTO) => {
deleteListing(listing.id);
(listingIds: number[]) => {
deleteListing(listingIds);
},
[deleteListing],
);
Expand All @@ -30,9 +26,5 @@ export const useMarketplaceService = () => {
addListingHandler,
);

useNuiEvent<MarketplaceDeleteDTO>(
'MARKETPLACE',
MarketplaceEvents.BROADCAST_DELETE,
deleteListingHandler,
);
useNuiEvent<number[]>('MARKETPLACE', MarketplaceEvents.BROADCAST_DELETE, deleteListingHandler);
};
8 changes: 4 additions & 4 deletions phone/src/apps/match/components/ActiveProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ const ActiveProfile = ({ profile, onSwipe }: IProps) => {
<>
<Draggable id="active-profile" onDrag={onDrag} onDrop={handleSwipe}>
<Card raised className={c.root}>
<StatusDisplay className={likeClass} text={t('APPS_MATCH_LIKED')} visible={isLiked} />
<StatusDisplay className={nopeClass} text={t('APPS_MATCH_NOPE')} visible={notLiked} />
<StatusDisplay className={likeClass} text={t('MATCH.LIKED')} visible={isLiked} />
<StatusDisplay className={nopeClass} text={t('MATCH.NOPE')} visible={notLiked} />
<Profile profile={profile} />
</Card>
</Draggable>
<Box className={c.buttons} display="flex" justifyContent="center">
<Tooltip title={t('APPS_MATCH_DISLIKE')} aria-label="dislike">
<Tooltip title={t('MATCH.DISLIKE')} aria-label="dislike">
<Fab
size="large"
color="secondary"
Expand All @@ -145,7 +145,7 @@ const ActiveProfile = ({ profile, onSwipe }: IProps) => {
<CancelIcon />
</Fab>
</Tooltip>
<Tooltip title={t('APPS_MATCH_LIKE')} aria-label="like">
<Tooltip title={t('MATCH.LIKE')} aria-label="like">
<Fab
size="large"
color="primary"
Expand Down
2 changes: 1 addition & 1 deletion phone/src/apps/match/components/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function NoProfiles() {
const [t] = useTranslation();
return (
<Box className={classes.root}>
<Typography variant="h5">{t('APPS_MATCH_NO_PROFILES')}</Typography>
<Typography variant="h5">{t('MATCH.FEEDBACK.NO_PROFILES')}</Typography>
</Box>
);
}
Expand Down
2 changes: 1 addition & 1 deletion phone/src/apps/match/components/matches/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Match = ({ match }: IProps) => {
setShowProfile((show) => !show);
};

const secondaryText = t('APPS_MATCH_PROFILE_MATCHED_AT', {
const secondaryText = t('MATCH.MESSAGES.PROFILE_MATCHED_AT', {
matchedAt: match.matchedAtFormatted,
});

Expand Down
2 changes: 1 addition & 1 deletion phone/src/apps/match/components/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Profile = ({ profile }: IProps) => {
{profile.name}
</Typography>
<Typography gutterBottom color="textSecondary" component="p">
{t('APPS_MATCH_PROFILE_LAST_ACTIVE', { lastActive: profile.lastActiveFormatted })}
{t('MATCH.MESSAGES.PROFILE_LAST_ACTIVE', { lastActive: profile.lastActiveFormatted })}
</Typography>
{bioSecondary && (
<Typography gutterBottom variant="body1" color="textSecondary" component="p">
Expand Down
Loading

0 comments on commit 1e79092

Please sign in to comment.