diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index bbedc87..e9f1bbe 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -16,7 +16,7 @@ import { useApps } from './os/apps/hooks/useApps'; import { useContactsService } from './apps/contacts/hooks/useContactsService'; import { useTwitterService } from './apps/twitter/hooks/useTwitterService'; import { useMatchService } from './apps/match/hooks/useMatchService'; -import { useSelloutService } from './apps/sellout/hooks/useSelloutService'; +import { useMarketplaceService } from './apps/marketplace/hooks/useMarketplaceService'; import { useBankService } from './apps/bank/hooks/useBankService'; import { useMessagesService } from './apps/messages/hooks/useMessageService'; import { useNotesService } from './apps/notes/hooks/useNotesService'; @@ -68,7 +68,7 @@ function Phone() { useContactsService(); useTwitterService(); useMatchService(); - useSelloutService(); + useMarketplaceService(); useBankService(); useMessagesService(); useNotesService(); diff --git a/phone/src/apps/sellout/components/SelloutApp.tsx b/phone/src/apps/marketplace/components/MarketplaceApp.tsx similarity index 57% rename from phone/src/apps/sellout/components/SelloutApp.tsx rename to phone/src/apps/marketplace/components/MarketplaceApp.tsx index 69c32ff..0307626 100644 --- a/phone/src/apps/sellout/components/SelloutApp.tsx +++ b/phone/src/apps/marketplace/components/MarketplaceApp.tsx @@ -1,28 +1,28 @@ import React from 'react'; import { AppWrapper } from '../../../ui/components/AppWrapper'; import { AppContent } from '../../../ui/components/AppContent'; -import { SelloutTitle } from './SelloutTitle'; -import { SelloutListContainer } from './SelloutList/SelloutListContainer'; +import { MarketplaceTitle } from './MarketplaceTitle'; +import { MarketplaceListContainer } from './SelloutList/MarketplaceListContainer'; import { NavigationBar } from './navigation/NavigationBar'; import { Switch, Route } from 'react-router-dom'; import { ListingFormContainer } from './form/ListingFormContainer'; import InjectDebugData from '../../../os/debug/InjectDebugData'; -import { SelloutThemeProvider } from '../providers/SelloutThemeProvider'; +import { MarketplaceThemeProvider } from '../providers/MarketplaceThemeProvider'; -export const SelloutApp = () => { +export const MarketplaceApp = () => { return ( - + - + - - + + - + ); }; @@ -35,8 +35,9 @@ InjectDebugData([ id: 1, name: 'Some guy', number: '111-1134', - title: 'Car', - description: 'Selling this cool car', + title: 'eeeeeeeeeeeeeeeeeeeeeeeee', + description: + 'skldfsd sajsfjklsdfj sdajsklfjdsjklas jskj sdjsd jasdkl sdjsf jasdklsfjfj kljasdkf jkaf jsdkla jsk jdkla j kljasdkf jkld jasd kljk', url: 'https://beta.iodine.gg/706Y3.jpeg', }, { diff --git a/phone/src/apps/sellout/components/SelloutTitle.tsx b/phone/src/apps/marketplace/components/MarketplaceTitle.tsx similarity index 95% rename from phone/src/apps/sellout/components/SelloutTitle.tsx rename to phone/src/apps/marketplace/components/MarketplaceTitle.tsx index 524f503..9640a9b 100644 --- a/phone/src/apps/sellout/components/SelloutTitle.tsx +++ b/phone/src/apps/marketplace/components/MarketplaceTitle.tsx @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const SelloutTitle = () => { +export const MarketplaceTitle = () => { const classes = useStyles(); return ( diff --git a/phone/src/apps/sellout/components/SelloutList/ListingActions.tsx b/phone/src/apps/marketplace/components/SelloutList/ListingActions.tsx similarity index 100% rename from phone/src/apps/sellout/components/SelloutList/ListingActions.tsx rename to phone/src/apps/marketplace/components/SelloutList/ListingActions.tsx diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/marketplace/components/SelloutList/MarketplaceItem.tsx similarity index 94% rename from phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx rename to phone/src/apps/marketplace/components/SelloutList/MarketplaceItem.tsx index bb6ea2d..f988733 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/marketplace/components/SelloutList/MarketplaceItem.tsx @@ -33,7 +33,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const SelloutItem = (listing: MarketplaceListing) => { +export const MarketplaceItem = (listing: MarketplaceListing) => { const classes = useStyles(); return ( @@ -62,7 +62,7 @@ export const SelloutItem = (listing: MarketplaceListing) => { )} - + {listing.description} diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx b/phone/src/apps/marketplace/components/SelloutList/MarketplaceList.tsx similarity index 63% rename from phone/src/apps/sellout/components/SelloutList/SelloutList.tsx rename to phone/src/apps/marketplace/components/SelloutList/MarketplaceList.tsx index 3fc753c..00e5ea2 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx +++ b/phone/src/apps/marketplace/components/SelloutList/MarketplaceList.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { List } from '../../../../ui/components/List'; import { useListing } from '../../hooks/useListing'; -import { SelloutItem } from './SelloutItem'; +import { MarketplaceItem } from './MarketplaceItem'; -export const SelloutList = () => { +export const MarketplaceList = () => { const listings = useListing(); return ( {listings.map((listing) => ( - + ))} ); diff --git a/phone/src/apps/marketplace/components/SelloutList/MarketplaceListContainer.tsx b/phone/src/apps/marketplace/components/SelloutList/MarketplaceListContainer.tsx new file mode 100644 index 0000000..12e889d --- /dev/null +++ b/phone/src/apps/marketplace/components/SelloutList/MarketplaceListContainer.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { MarketplaceList } from './MarketplaceList'; + +export const MarketplaceListContainer = () => { + return ; +}; diff --git a/phone/src/apps/sellout/components/form/ListingForm.tsx b/phone/src/apps/marketplace/components/form/ListingForm.tsx similarity index 57% rename from phone/src/apps/sellout/components/form/ListingForm.tsx rename to phone/src/apps/marketplace/components/form/ListingForm.tsx index 47c6fd7..47d02c1 100644 --- a/phone/src/apps/sellout/components/form/ListingForm.tsx +++ b/phone/src/apps/marketplace/components/form/ListingForm.tsx @@ -1,7 +1,10 @@ import React, { useState } from 'react'; -import { makeStyles, Button, TextField } from '@material-ui/core'; +import { makeStyles, Button, TextField, Typography } from '@material-ui/core'; import Nui from '../../../../os/nui-events/utils/Nui'; import { MarketplaceEvents } from '../../../../../../typings/marketplace'; +import { useSnackbar } from '../../../../ui/hooks/useSnackbar'; +import { useTranslation } from 'react-i18next'; +import { useHistory } from 'react-router'; const useStyles = makeStyles((theme) => ({ root: { @@ -29,17 +32,28 @@ const useStyles = makeStyles((theme) => ({ export const ListingForm = () => { const classes = useStyles(); + const { t } = useTranslation(); + const { addAlert } = useSnackbar(); + const history = useHistory(); const [title, setTitle] = useState(''); const [url, setUrl] = useState(''); const [description, setDescription] = useState(''); const addListing = () => { - Nui.send(MarketplaceEvents.ADD_LISTING, { - title, - url, - description, - }); + if (title !== '' && description !== '') { + Nui.send(MarketplaceEvents.ADD_LISTING, { + title, + url, + description, + }); + history.push('/marketplace'); + } else { + addAlert({ + message: t('APPS_MARKETPLACE_REQUIRED_FIELDS'), + type: 'error', + }); + } }; return ( @@ -48,15 +62,22 @@ export const ListingForm = () => { setTitle(e.target.value)} - placeholder="Title on listing.." - inputProps={{ className: classes.textFieldInput }} + label={t('GENERIC_REQUIRED')} + placeholder={t('APPS_MARKETPLACE_FORM_TITLE')} + inputProps={{ + className: classes.textFieldInput, + maxLength: 25, + }} style={{ width: '80%' }} size="medium" + InputLabelProps={{ + shrink: true, + }} /> setUrl(e.target.value)} inputProps={{ className: classes.textFieldInput }} style={{ width: '80%' }} @@ -67,15 +88,21 @@ export const ListingForm = () => { setDescription(e.target.value)} - placeholder="Description" - inputProps={{ className: classes.multilineFieldInput }} + label={t('GENERIC_REQUIRED')} + placeholder={t('APPS_MARKETPLACE_FORM_DESCRIPTION')} + inputProps={{ + className: classes.multilineFieldInput, + maxLength: 130, + }} style={{ width: '80%' }} size="medium" + InputLabelProps={{ + shrink: true, + }} multiline rows={4} variant="outlined" /> - diff --git a/phone/src/apps/sellout/components/form/ListingFormContainer.tsx b/phone/src/apps/marketplace/components/form/ListingFormContainer.tsx similarity index 100% rename from phone/src/apps/sellout/components/form/ListingFormContainer.tsx rename to phone/src/apps/marketplace/components/form/ListingFormContainer.tsx diff --git a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx b/phone/src/apps/marketplace/components/navigation/NavigationBar.tsx similarity index 94% rename from phone/src/apps/sellout/components/navigation/NavigationBar.tsx rename to phone/src/apps/marketplace/components/navigation/NavigationBar.tsx index 91c8384..686b886 100644 --- a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/marketplace/components/navigation/NavigationBar.tsx @@ -31,9 +31,9 @@ export const NavigationBar = () => { } - to="/sellout" + to="/marketplace" /> - } to="/sellout/new" /> + } to="/marketplace/new" /> ); }; diff --git a/phone/src/apps/sellout/hooks/state.ts b/phone/src/apps/marketplace/hooks/state.ts similarity index 100% rename from phone/src/apps/sellout/hooks/state.ts rename to phone/src/apps/marketplace/hooks/state.ts diff --git a/phone/src/apps/sellout/hooks/useListing.ts b/phone/src/apps/marketplace/hooks/useListing.ts similarity index 100% rename from phone/src/apps/sellout/hooks/useListing.ts rename to phone/src/apps/marketplace/hooks/useListing.ts diff --git a/phone/src/apps/sellout/hooks/useSelloutService.ts b/phone/src/apps/marketplace/hooks/useMarketplaceService.ts similarity index 94% rename from phone/src/apps/sellout/hooks/useSelloutService.ts rename to phone/src/apps/marketplace/hooks/useMarketplaceService.ts index bd25ae8..00a1e8f 100644 --- a/phone/src/apps/sellout/hooks/useSelloutService.ts +++ b/phone/src/apps/marketplace/hooks/useMarketplaceService.ts @@ -6,7 +6,7 @@ import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar'; import { useTranslation } from 'react-i18next'; import { MarketplaceEvents } from '../../../../../typings/marketplace'; -export const useSelloutService = () => { +export const useMarketplaceService = () => { const setSellout = useSetRecoilState(selloutState.listing); const { addAlert } = useSnackbar(); const { t } = useTranslation(); diff --git a/phone/src/apps/sellout/sellout.theme.ts b/phone/src/apps/marketplace/marketplace.theme.ts similarity index 100% rename from phone/src/apps/sellout/sellout.theme.ts rename to phone/src/apps/marketplace/marketplace.theme.ts diff --git a/phone/src/apps/marketplace/providers/MarketplaceThemeProvider.tsx b/phone/src/apps/marketplace/providers/MarketplaceThemeProvider.tsx new file mode 100644 index 0000000..e9a9cd9 --- /dev/null +++ b/phone/src/apps/marketplace/providers/MarketplaceThemeProvider.tsx @@ -0,0 +1,5 @@ +import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider'; + +import selloutTheme from '../marketplace.theme'; + +export const MarketplaceThemeProvider = createAppThemeProvider(selloutTheme); diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx deleted file mode 100644 index eccda41..0000000 --- a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import { SelloutList } from './SelloutList'; - -export const SelloutListContainer = () => { - return ; -}; diff --git a/phone/src/apps/sellout/providers/SelloutThemeProvider.tsx b/phone/src/apps/sellout/providers/SelloutThemeProvider.tsx deleted file mode 100644 index 6b7cd93..0000000 --- a/phone/src/apps/sellout/providers/SelloutThemeProvider.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider'; - -import selloutTheme from '../sellout.theme'; - -export const SelloutThemeProvider = createAppThemeProvider(selloutTheme); diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 48bb638..c6157e0 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -189,16 +189,21 @@ "APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown", "APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing", - "APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing", + "APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Failed to create a new listing", "APPS_MARKETPLACE_DELETE_LISTING_SUCCESS": "Successfully delete listing", "APPS_MARKETPLACE_DELETE_LISTING_FAILED": "Failed to delete listing", "APPS_MARKETPLACE_REPORT_LISTING_FAILED": "This listing has already been reported", "APPS_MARKETPLACE_REPORT_LISTING_SUCCESS": "Successfully reported listing", + "APPS_MARKETPLACE_REQUIRED_FIELDS": "All required fields must be filled!", + "APPS_MARKETPLACE_FORM_TITLE": "Title", + "APPS_MARKETPLACE_FORM_IMAGE": "Image or URL", + "APPS_MARKETPLACE_FORM_DESCRIPTION": "Description", "GENERIC_CLICK_TO_REVEAL": "Click to reveal", "GENERIC_WAIT": "Please wait...", "GENERIC_SAVE": "Save", "GENERIC_UPDATE": "Update", + "GENERIC_REQUIRED": "Required", "GENERIC_DELETE": "Delete", "GENERIC_REPORT": "Report", "GENERIC_CALL": "Call", diff --git a/phone/src/os/apps/config/apps.tsx b/phone/src/os/apps/config/apps.tsx index 2370952..9255670 100644 --- a/phone/src/os/apps/config/apps.tsx +++ b/phone/src/os/apps/config/apps.tsx @@ -25,7 +25,7 @@ import { MessagesApp } from '../../../apps/messages/components/MessagesApp'; import { MatchApp } from '../../../apps/match/components/MatchApp'; import { TwitterApp } from '../../../apps/twitter/components/TwitterApp'; import { ExampleApp } from '../../../apps/example/components/ExampleApp'; -import { SelloutApp } from '../../../apps/sellout/components/SelloutApp'; +import { MarketplaceApp } from '../../../apps/marketplace/components/MarketplaceApp'; import { NotesApp } from '../../../apps/notes/NotesApp'; import CameraApp from '../../../apps/camera/components/CameraApp'; import { AppRoute } from '../components/AppRoute'; @@ -41,7 +41,7 @@ import { import { SELLOUT_APP_PRIMARY_COLOR, SELLOUT_APP_ICON_COLOR, -} from '../../../apps/sellout/sellout.theme'; +} from '../../../apps/marketplace/marketplace.theme'; import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme'; import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme'; import { @@ -149,8 +149,8 @@ export const APPS: IAppConfig[] = [ notificationIcon: , backgroundColor: SELLOUT_APP_PRIMARY_COLOR, color: SELLOUT_APP_ICON_COLOR, - path: '/sellout', - Route: () => , + path: '/marketplace', + Route: () => , }, { id: 'NOTES', diff --git a/resources/client/cl_sellout.ts b/resources/client/cl_marketplace.ts similarity index 100% rename from resources/client/cl_sellout.ts rename to resources/client/cl_marketplace.ts diff --git a/resources/client/client.ts b/resources/client/client.ts index dccf6c4..c7dbed6 100644 --- a/resources/client/client.ts +++ b/resources/client/client.ts @@ -3,7 +3,7 @@ import ClientUtils from './cl_utils'; import './cl_main'; import './cl_twitter'; import './cl_contacts'; -import './cl_sellout'; +import './cl_marketplace'; import './cl_bank'; import './cl_notes'; import './cl_photo'; diff --git a/resources/server/server.ts b/resources/server/server.ts index e894106..fa984a5 100644 --- a/resources/server/server.ts +++ b/resources/server/server.ts @@ -4,7 +4,7 @@ import './db'; import './sv_twitter'; import './sv_main'; import './sv_contacts'; -import './sv_sellout'; +import './sv_marketplace'; import './sv_bank'; import './sv_notes'; import './sv_photo'; diff --git a/resources/server/sv_sellout.ts b/resources/server/sv_marketplace.ts similarity index 100% rename from resources/server/sv_sellout.ts rename to resources/server/sv_marketplace.ts