How to handle API changes - Swiggy Restaurant Menu API - Namaste React
Resumen
TLDRNan videyo sa a, yo eksplike kijan chanjman API a afekte aplikasyon meni restoran yo. Otè a demontre kijan pou adapte aplikasyon an ak estrikti done nouvo a, e konsa fè li pi fasil pou jere kòd akòz chanjman yo. Sa enplike kreye yon UI modile ki ka fasilman adapte ak chanjman nan API a san yo pa bezwen rekonfigire konplètman sistem nan. Li montre kijan estrikti done a ka klase an diferan kategori konnen kòm kategori meni ak kategori meni nèst, epi kijan sa yo gen pwòp done ak spesifikasyon. Nan fen videyo a, otè a montre yon pwototip UI ki entegre nouvo done sa yo efektivman.
Para llevar
- 🔄 Chanjman API a nesesè pou restoran aplike estrikti done ki ajiste.
- 📱 Anplikasyon meni a bezwen chanjman nan kod modilè pou entegre nouvo estrikti yo.
- ⛏️ Yon bon estrikti modilè evite besoin re-kòd tout sistèm nan chak fwa gen chanjman.
- 🗂️ Estrikti done restoran yo ka genyen kategori meni ak kategori meni nèst.
- 👨💻 Devlopè a montre kijan pou kod kòrèkteman nouvo estrikti a pou UI a travay byen.
- 🔢 Diferan kategori yo gen bezwen ki espesifik pou entegre pwofondman tout done nan UI a.
- 🎨 Nouvo UI a gen estrikti diferan ak layout avanse.
- 🧱 Re-itilize konpozan nan kod la fè chanjman yo pi fasil epi pi efikas.
- 🔍 Komprann estrikti done a se etap enpòtan pou devlopman.
- 🧩 Pwototip UI montre kijan done yo entegre efektivman nan aplikasyon an.
Cronología
- 00:00:00 - 00:05:00
Pale sou chanjman API ki afekte afichaj meni restoran an nan aplikasyon an epi eksplike enpòtans de estrikti done a. Chanjman nan ka sòti swa nan bò API oswa bò UX, e li enpòtan pou developè vin fleksib nan entegre chanjman sa yo.
- 00:05:00 - 00:10:00
Anonse ke estrikti done a chanje e montre ansyen estrikti done ak modifikasyon UI ki te fèt nan Wiki a. Diskite sou de senaryo kote swa modifikasyon UI oswa estrikti API chanje e bay reskonsabilite developè a.
- 00:10:00 - 00:15:00
Fè yon jeneralizasyon sou ansyen estrikti done a pou meni yo ak kategori, e eksplike ki jan UI a te prezante tou sa avè imaj, non, zòn, ak lòt infòmasyon nan yon fason espesifik. Mete aksan sou fasilite manipilasyon done yo anvan chanjman yo.
- 00:15:00 - 00:20:00
Diskite sou nouvo estrikti API a e montre de egzanp diferan sòti nan restoran tankou Burger King ak KFC. Diskite fason done yo òganize avèk kategori ak atik, e eksplike ki jan sa ka afekte afichaj nan aplikasyon an.
- 00:20:00 - 00:25:00
Diskite sou estrikti done konplèks ak kategori anbraye, itilize egzanp Pizza Hut pou montre kijan done lisans ak adrès restoran an ka afekte. Mete aksan sou chanjman estrikti URL la ki enkli nouvo query paramète ki bezwen gen ladan ID restoran ak lòt done kle.
- 00:25:00 - 00:30:00
Diskite sou detay done reponn API a ak siyifikasyon divès eleman nan API a, fè yon konparezon ak done Java ki ka gen menm estrikti eksepsyonèlman avèk baliz ki gen enfòmasyon sou restoran yo.
- 00:30:00 - 00:35:00
Estrikti done nan diferan nivo ak anbraye done atik, estrikti sa a montre kijan done yo òganize soti nan yon nivo jeneral a kategori anbraye. Sa sèvi kòm yon eksplorasyon pwofondè sou estrikti done nan endistri restoran an.
- 00:35:00 - 00:40:00
Prezante yon diskisyon sou entèseksyon ak divès mòd done ak ki jan nou kapab implante sa a nan kad UI a apati nan yon espèk komponentè. Diskite sou pwosesis modifikasyon done ak transfè diferan done an nan sistèm aplikasyon an.
- 00:40:00 - 00:45:18
Ekspoze modifikasyon ki fèt nan kod UI a ki itilize API chanje a pou montre enfòmasyon sou restoran yo, lis meni, ak kategori atik. Mennen yon diskisyon sou fason estrikti done yo ak entèpretasyon yo nan apèsi diferan modèl done e fason sa a ka aplike nan devlopman aplikasyon an.
Mapa mental
Preguntas frecuentes
Ki API ki te chanje pou meni restoran an?
Yon nouvo chanjman nan API a ki lakòz meni restoran yo pa montre kòrèkteman nan aplikasyon an.
Kijan yon devlopè ka entegre nouvo estrikti done yo nan UI a?
Yon devlopè dwe entegre nouvo estrikti API a ak UI a pa fasilite entegasyon pa mwayen yon estrikti kod ki modulè.
Ki sòt done restoran yo ka genyen nan API a?
API a ka genyen done tankou enfòmasyon restoran, kategori meni, ak kategori meni nèst.
Kisa ki fè kategori meni nèst diferan?
Kategori meni nèst genyen lòt sub-kategori andedan yo, ki chak gen pwòp atik meni yo.
Kijan yon devlopè ka fasilite chanjman nan estrikti done?
Yo ka modile estrikti kod yo, sèpare tit, meni, ak detay ak entegre estrikti done nan chak seksyon.
Ki lòt karakteristik espresyon yo te ajoute nan aplikasyon a?
Nouvo UI a te gen yon orè ajiste ak konfigirasyon diferan nan meni restoran an.
Kisa ki dewoule lè yon chanjman nan estrikti API nesesè?
Li ka nesesè retire kòd anvan an epi rekode sipò pou nouvo estrikti a pou asire entegasyon.
Ki mezi ki ka pran pou fè fas ak chanjman sa yo?
Kòd modulè pèmèt chanjman yo pi rasyonèl pandan y ap re-itilize konpozan ki deja egziste.
Kijan yon pwototip UI montre enfòmasyon nan dènyèman?
Yon UI senp te devlope kote itilizatè yo ka wè enfòmasyon restoran ak yon lis meni ak detay sou kategori a.
Ver más resúmenes de vídeos
Motu Patlu | Season 5 | Patlu Ke Haath | Episode 170 Part 1 | Voot Kids
Ultrasound Guided Genicular Blocks (2024 update!)
🔥Ai video kaise banaye | 🔎new ai copy paste channel ideas on youtube earn money💰#ai #growyourchannel
Video Cheran las otras empresas
Why You Waste Money On Skins (Fortnite, Destiny 2, Apex Legends)
Top 𝗙𝗶𝘃𝗲 Reasons Why Indian Americans Voted 𝗥𝗲𝗽𝘂𝗯𝗹𝗶𝗰𝗮𝗻 Donald Trump • Utsav Chakrabarti
- 00:00:02hi everyone uh so a lot of people were
- 00:00:05asking me about the new API change that
- 00:00:08happened in the speaking and data is not
- 00:00:11working for the restaurant menu listing
- 00:00:13this all this data is not being
- 00:00:14displayed in our
- 00:00:16um in the app that we have designed and
- 00:00:18created
- 00:00:20um so I wanted to create a video to
- 00:00:22explain the new data structure and how
- 00:00:24you can implement it I'm not going to
- 00:00:26spawn feed any anyhow but I'm just going
- 00:00:29to explain the data structure and the
- 00:00:32importance of this in the real life so
- 00:00:37to start with uh like this is the work
- 00:00:39of the content developer like
- 00:00:40integrating the backend API and the UI
- 00:00:44screens that we get
- 00:00:45so two two things can happen
- 00:00:49either the ux designers they can now
- 00:00:52change the layout of the screen like
- 00:00:54they wanted to introduce a new layout if
- 00:00:57you see in the old UI in this Wiki what
- 00:01:00they had was they had the information
- 00:01:02with the background here restaurant
- 00:01:03information they would have in the left
- 00:01:06hand side they were having some widgets
- 00:01:09which had the categories in the middle
- 00:01:11they were having all the menu items
- 00:01:13listed and the right side they were
- 00:01:15having the cart card details now they
- 00:01:18have changed the UI screen so uh one day
- 00:01:21it could be like ux designers have the
- 00:01:23uh restructured their UI design or the
- 00:01:27other way we could think this like we
- 00:01:29could think is the API structure was
- 00:01:32changed like the backend developers they
- 00:01:36wanted to change the API structure to
- 00:01:39make some
- 00:01:40um easy for the ux um you UI to be
- 00:01:44displayed or something like that so it
- 00:01:47could happen the both ways so being a
- 00:01:49friend developer our work is to
- 00:01:51integrate both the things
- 00:01:54um so we can't uh
- 00:01:56we might have developed a feature with
- 00:01:59all this in the previous version with
- 00:02:02her heart and soul to develop it but uh
- 00:02:04in the next version we might have to
- 00:02:06remove all the code that we have written
- 00:02:08and we have to create from scratch or
- 00:02:11new things so if your code if you have
- 00:02:14written the code in modular structure
- 00:02:16like you have separated out the header
- 00:02:18your footer doesn't get this Disturbed
- 00:02:21only in only the part like if you have
- 00:02:24already returned this particular
- 00:02:25information
- 00:02:27like a
- 00:02:29all the restaurant information in a
- 00:02:31separate component your menu items in a
- 00:02:33separate component your cart in a
- 00:02:34simplate component in your widget in a
- 00:02:36separate complaint this changes might be
- 00:02:38a little easy for you because it's just
- 00:02:41like a structure of the data which
- 00:02:43you're passing to this component is
- 00:02:45going to change but all the component uh
- 00:02:47and the UI also you can change in the
- 00:02:49particular component so that is one
- 00:02:52thing
- 00:02:55first thing is like you have to think
- 00:02:58that it's not that complicated and it's
- 00:03:01challenging so let's do that uh changes
- 00:03:05first um let's see how the whole
- 00:03:07structure
- 00:03:09the speaky data was I am having that in
- 00:03:13my config.json file
- 00:03:17so this was the old mock data old data
- 00:03:21structure I have marked it so if you see
- 00:03:24earlier it was coming under
- 00:03:26data so data there was all the restraint
- 00:03:31information was directly given the ID
- 00:03:33name and all the area and average
- 00:03:36whatever is displayed in this part was
- 00:03:38directly given so our UI was looking
- 00:03:41something like
- 00:03:43this this part which is lighting with
- 00:03:45the image and everything was coming here
- 00:03:48directly and uh
- 00:03:56let me open it uh it was coming directly
- 00:04:00and
- 00:04:01um under uh items menu items we were
- 00:04:05getting all the menu items that is
- 00:04:06displayed in the center and all the left
- 00:04:09hand side of the menu items if you
- 00:04:10remember it was coming under widget
- 00:04:12under widget you were getting all this
- 00:04:14recommended and everything
- 00:04:17on the item category name that was
- 00:04:19getting displayed like uh recommended is
- 00:04:21one category
- 00:04:23um this is one plum cake is one category
- 00:04:25and all that stuff like uh all this is
- 00:04:28one one category
- 00:04:31so this was displayed in the left side
- 00:04:33and the center items were coming in the
- 00:04:34sent items so mapped with an ID
- 00:04:37particular ID you are getting all that
- 00:04:39items displayed
- 00:04:40so this was the whole data structure we
- 00:04:43were we what we did was we just um for
- 00:04:46displaying the menu items we went to
- 00:04:48menu dot items dot we were mapping all
- 00:04:50the
- 00:04:51object.values of all this particular
- 00:04:53thing and we were looping and showing it
- 00:04:55it was not that complicated and we felt
- 00:04:58it was easy to display now currently
- 00:05:00what they did was
- 00:05:03um let's go and see what has happened to
- 00:05:05our current uh
- 00:05:07API so let me open now
- 00:05:12uh one particular restaurant which has
- 00:05:15all the
- 00:05:17information so Pizza Hut has everything
- 00:05:22so where's Pizza Hut
- 00:05:26producing Pizza Hut somewhere
- 00:05:30um
- 00:05:31I'll just open one one post or Burger
- 00:05:34King
- 00:05:35so Burger King has an information recent
- 00:05:38information
- 00:05:39uh it has some option for veg only some
- 00:05:45filter and it has a recommended drop
- 00:05:48down so if I close all the drop downs I
- 00:05:50can see that each drop down is having
- 00:05:52some dishes so let me close everything
- 00:05:56uh it's having some category and some
- 00:05:58items inside that category items so
- 00:06:01there are four categories and four uh
- 00:06:03multiple items one item inside this 26
- 00:06:06items 20 item five items and there is
- 00:06:08the restaurant license and the address
- 00:06:11so this is one type of data that is
- 00:06:13coming let's go and open another type so
- 00:06:16KFC let's see KFC how KFC is having
- 00:06:19their data
- 00:06:21so KFC is also having restraint
- 00:06:23information it's having one more in
- 00:06:26Burger King there was no such offer code
- 00:06:28here they have offer code here they have
- 00:06:31the filter if they have some Carousel
- 00:06:34kind of thing so if I
- 00:06:36I can move here and there even here they
- 00:06:39are having item category so this is one
- 00:06:42type of data that is coming
- 00:06:45then one more thing which has uh nested
- 00:06:48items so let's open that I saw that in
- 00:06:52keep
- 00:06:53very cool Pizza Hut
- 00:06:57think
- 00:07:00in India it's closed right now so let me
- 00:07:04open some other restaurant which has
- 00:07:08I think Pizza Huts here it's open only
- 00:07:11sorry
- 00:07:12so Pizza Hut if you see
- 00:07:14it has restaurant information it has
- 00:07:17offer code it has um
- 00:07:19filter batch veg filter batch
- 00:07:22menu Carousel and multiple items
- 00:07:27so here if you see inside item there is
- 00:07:30one more drop down
- 00:07:32inside this item category there is one
- 00:07:34more category called
- 00:07:36um veg Peas on on which Pisa and dip and
- 00:07:39all that so if you open them there is
- 00:07:41dishes so I can think this is nested the
- 00:07:44item category so
- 00:07:46one category is having another category
- 00:07:49so that is having the data so this is
- 00:07:51called nested category
- 00:07:54so other things are same even this let
- 00:07:57me minimize it so that it will be easy
- 00:07:58to see
- 00:08:00all the restaurant information so this
- 00:08:03skin will be minimized because it is
- 00:08:05nested
- 00:08:06all this let me close
- 00:08:09Beverages and license and this
- 00:08:12information so since Visa it is having
- 00:08:15all the
- 00:08:16data let me take Visa open Visa has some
- 00:08:23Network Tab and open Pizza Hut
- 00:08:26so this is the URL new URL
- 00:08:33you see the URL structure it is being
- 00:08:36changed first it is having
- 00:08:39um this is the end point
- 00:08:41it is having multiple query query params
- 00:08:44like page type complete menu is latitude
- 00:08:48longitude and restaurant ID
- 00:08:51so for me the concern is like uh
- 00:08:54latitude longitude and the restaurant ID
- 00:08:56so these three information I'll be
- 00:08:59passing and I want to get
- 00:09:01um the particular restaurant information
- 00:09:03so what does the response that I'm
- 00:09:06getting this is the structure of the
- 00:09:09response that I'm getting let me open
- 00:09:10this side so this is the important thing
- 00:09:12which I'm going to see so under data
- 00:09:16I have cards so under cards there are
- 00:09:19three this is cards is an array so three
- 00:09:21elements are there so first element let
- 00:09:25me see everything has okay these two
- 00:09:28things have card but this is having
- 00:09:30group card
- 00:09:32okay so the first one is having another
- 00:09:35card this one is also having another
- 00:09:37card
- 00:09:38so inside card
- 00:09:41can you see some similarities here so
- 00:09:44even this is having a type this is
- 00:09:46having a type
- 00:09:47so
- 00:09:48I type here if you see this has a long
- 00:09:52string type okay
- 00:09:55um what I think this could be is like in
- 00:09:57back end they are trying to store it in
- 00:09:59some kind of package structure it could
- 00:10:02be that way in Java they will be storing
- 00:10:04this way right so my concern is this
- 00:10:06restaurant so restaurant and here grid
- 00:10:09widget so here instant what I can
- 00:10:12understand from this is like this
- 00:10:14particular card
- 00:10:16on this particular card object is going
- 00:10:18to have the information about my
- 00:10:20restaurant dot there is one info so this
- 00:10:23particular thing is going to have all my
- 00:10:25restaurant information this particular
- 00:10:26part so if you have written a particular
- 00:10:30uh
- 00:10:31okay just keep in mind we can structure
- 00:10:34the component like how many components
- 00:10:36should be there later so for now this
- 00:10:38part is coming from this particular
- 00:10:40information okay
- 00:10:42okay it has a name what I need name yes
- 00:10:46it has name it has uh uh Cuisines yes it
- 00:10:51has Cuisines it has a distance area yes
- 00:10:54it has Bangalore it has Indra nagar
- 00:10:58um all the distance parameters I think
- 00:11:00it will be in SLA yes it has maximum
- 00:11:03time delivery time it has um
- 00:11:06it has ratings so I think rating is
- 00:11:08prettier rating and all ratings okay and
- 00:11:12cost for two everything is here till
- 00:11:13here it is there in this test end so
- 00:11:16good so this particular card we
- 00:11:19understood
- 00:11:24one is having this grid wizard grid
- 00:11:27wizard is nothing but this particular
- 00:11:29part I think so let me open it
- 00:11:33and there are a lot of other things like
- 00:11:34grid element in post Tales layout
- 00:11:37okay let's see what it is
- 00:11:40so again it is having offer info with
- 00:11:43stale so this is going to have
- 00:11:45information about the offers with the
- 00:11:47style things included that's what it's
- 00:11:49trying to explain I think
- 00:11:51so here under info I'm having all the
- 00:11:54details that is to be printed here so it
- 00:11:57is having what coupon I should show What
- 00:12:00description it has all these values like
- 00:12:02logo and everything it has
- 00:12:05so I understand that this cards of one
- 00:12:08is nothing but this particular part of
- 00:12:10the UI this particular part of the UI
- 00:12:12yes so cart of two card cards of two is
- 00:12:17nothing but a group cards
- 00:12:20so
- 00:12:21I just have this cards of two I don't
- 00:12:23have any other information so what I can
- 00:12:25understand is this cards of two is going
- 00:12:27to have all this information
- 00:12:29all this whole thing uh it is going to
- 00:12:32have so how they have divided let's see
- 00:12:36they have grouped cards card group map
- 00:12:40so regular and cards so why this kind of
- 00:12:44structure could be there is my
- 00:12:45assumption is like um there could be in
- 00:12:48future one more card group coming in
- 00:12:50named special or something so this is
- 00:12:52regular menu there could be a special
- 00:12:54menu there could be a some kind of
- 00:12:57[Music]
- 00:12:58different kind of menu coming in this
- 00:13:00card could be a complete menu partial
- 00:13:02menu or something like that so this is
- 00:13:04regular menu and for now there is
- 00:13:08nothing I have checked so this is the
- 00:13:09structure in which it's going to come
- 00:13:11and inside card cards there are multiple
- 00:13:14cards so there are 17 cards so in Array
- 00:13:17it starts from 0 to 16 so 17.
- 00:13:20how how come 17 let's um
- 00:13:25let's see there is Bridge
- 00:13:27visually is uh 0 this is one uh topic so
- 00:13:31let's see if it is that is my assumption
- 00:13:33let's see so let's open cart everybody
- 00:13:36is having card card so let's open card
- 00:13:39card
- 00:13:40card
- 00:13:42card
- 00:13:48okay let's go to the bottom
- 00:13:54okay let's see
- 00:13:56um so the first uh first element of this
- 00:13:58cards is nothing but again I'll go to
- 00:14:02the end it is menu
- 00:14:05menu which filter and batch so this is
- 00:14:08the first card item wedge only filter
- 00:14:12button I think this is what is going to
- 00:14:14have information about this
- 00:14:16and cards of one is going to have a menu
- 00:14:19carousel
- 00:14:21and this is the menu carousel
- 00:14:25okay
- 00:14:29menu Carousel and uh
- 00:14:33the third item is nothing but
- 00:14:35recommended right or item item category
- 00:14:38item category
- 00:14:39third one is item let me close this
- 00:14:43third card is nothing but recommended so
- 00:14:46that is one item category item category
- 00:14:48is nothing but I can open that and then
- 00:14:51see the dishes directly that is item
- 00:14:54category component and next one is also
- 00:14:58item category component that is one
- 00:15:00place is also item category component
- 00:15:02the fourth one is
- 00:15:05this new cheesy Momo Mia so this is like
- 00:15:08a nested item category nested item
- 00:15:10category as I already mentioned it has a
- 00:15:13lot of categories inside it
- 00:15:16um
- 00:15:18so four categories are inside it so this
- 00:15:20is called nested category so inside
- 00:15:24um the nested category if I open I'll be
- 00:15:26having something this structure looks
- 00:15:29similar to what we have seen here let's
- 00:15:31see that later like how to do it so this
- 00:15:34is how it is the data is so all this
- 00:15:37data let me close it
- 00:15:48okay so last one is like
- 00:15:52last one is distant address so if you
- 00:15:55see it contains Restaurant address the
- 00:15:57previous the one before that is
- 00:15:59restaurant license info yeah this is the
- 00:16:02resident license info so this might be a
- 00:16:05different component this could be in my
- 00:16:06I'm not going to do this like this is
- 00:16:09not my concern my concern is only nested
- 00:16:12items and items so even I am not going
- 00:16:15to do this veg options and carousels
- 00:16:18also if you are interested and this
- 00:16:19particular grid wizard also if you are
- 00:16:21interested you can Implement all that
- 00:16:23you have seen the structure here how it
- 00:16:25is there so just create a component for
- 00:16:28this and pass that particular props here
- 00:16:30and show it same wise like you know
- 00:16:33where this particular wedge option is
- 00:16:35coming carts of zero
- 00:16:38this particular cards of zeros having
- 00:16:41this veg menu items just pass this props
- 00:16:44to this and show in the similar way top
- 00:16:47picks is nothing but this menu Carousel
- 00:16:49item this is which is in cards of one
- 00:16:52which has menu Carousel which you can
- 00:16:54just pass this kerosol it has all the
- 00:16:57four five items so this particular menu
- 00:16:59Carousel it has you can show that
- 00:17:02so in this particular thing I'm going to
- 00:17:05explain about this item categories and
- 00:17:07nested item categories
- 00:17:10so
- 00:17:12um that is here right item categories
- 00:17:14and listed item categories
- 00:17:18so what is the difference how will I
- 00:17:20differentiate uh from the data whether
- 00:17:22it is nested item category or item
- 00:17:24category so with this ad type so at type
- 00:17:28attribute is having a value nested item
- 00:17:32get some long string an ending with
- 00:17:34nested item category and this one is
- 00:17:37item category so if
- 00:17:39if these two things are there
- 00:17:43um since I'm not concerned about
- 00:17:44anything else
- 00:17:45these two things is just my concern okay
- 00:17:48I'm just taking uh
- 00:17:51um these two things item category also
- 00:17:53I'm opening this is item category this
- 00:17:56is nested item categories in the item
- 00:17:57category
- 00:17:59like this one plus one medium at the six
- 00:18:03forty nine this has four items right
- 00:18:06like super value deal Super Value deal
- 00:18:09and four items are there to wedge into
- 00:18:12non-veg okay so these are Under item
- 00:18:15cards
- 00:18:16so item cards there are four cards
- 00:18:19so each card is having a dish yes so my
- 00:18:23end the atomic uh part is a dish
- 00:18:27so last component of this would be a
- 00:18:30dish which has
- 00:18:31a name a praise and all description and
- 00:18:34an image so this I'll be having it as a
- 00:18:38component that I'm imagining this could
- 00:18:40be a component and this uh one plus one
- 00:18:43medium could be another component which
- 00:18:45is having which will Loop through this
- 00:18:47card items and show me all this dishes
- 00:18:51so what I could think of is like
- 00:18:54particular this particular card is
- 00:18:57having this type right like four items
- 00:18:59it is having
- 00:19:00let me close this it is having this
- 00:19:02particular card is having a title so
- 00:19:04title is this I'll just display this as
- 00:19:07one component which has a title and
- 00:19:10display and for showing these items like
- 00:19:12these four items I will be um looping a
- 00:19:16looping in this items card card I'll be
- 00:19:20mapping around this and showing
- 00:19:22um
- 00:19:23I'll be passing each item of this array
- 00:19:27as props to my menu items menu item
- 00:19:31component menu item is nothing but the
- 00:19:33dish component this dish particular dish
- 00:19:35values it is having right it is having
- 00:19:38information about my particular dish
- 00:19:40like name of the dish like Super Value
- 00:19:43two medium which pizza so this is one
- 00:19:45name of the dish it is having praise
- 00:19:48it is having description
- 00:19:51um it is also having image ID so I'll be
- 00:19:54passing this particular info I'll be
- 00:19:57passing this info as props to my menu
- 00:20:00item component and this will be my item
- 00:20:03category component this particular part
- 00:20:05will be my item category components
- 00:20:07props
- 00:20:08so next nested item category so nested
- 00:20:12item categories having categories so my
- 00:20:16nested component is again having let me
- 00:20:18close this a title so I'll be showing
- 00:20:21some title and I'll be looping around
- 00:20:23this category
- 00:20:25um category object array and each I'll
- 00:20:30be passing
- 00:20:32so if you see the categories of array it
- 00:20:36is having a same uh each element is
- 00:20:39having the same data structure as my
- 00:20:42item category if you see my item
- 00:20:43category it is having title item cards
- 00:20:46even here in the categories since having
- 00:20:48title item cards so what I can think of
- 00:20:52is to reuse the item category component
- 00:20:55which we have returned and pass this
- 00:20:57particular crop as props to that
- 00:20:59particular component so if I pass this
- 00:21:03title will go to as title and this
- 00:21:06particular object will go already I have
- 00:21:07done all the logic in my item category
- 00:21:09component right like that we can do so I
- 00:21:12I can understand that by this
- 00:21:15particular data structure
- 00:21:17so that's all so this is the way like
- 00:21:20you can start coding so your backend
- 00:21:22developer will um
- 00:21:24have some
- 00:21:26um
- 00:21:27have some
- 00:21:28understanding about um like we should
- 00:21:31have some understanding with the backend
- 00:21:33developer about this data structure
- 00:21:34there will be sharing this data
- 00:21:36structure we'll be getting the screens
- 00:21:37from the ux designers now we have to
- 00:21:40integrate both the things or
- 00:21:43there will be some
- 00:21:45um web developer in between who will be
- 00:21:47writing all this um hard-coded values
- 00:21:50for this and they'll be just giving the
- 00:21:53quote to us now our work is to make it
- 00:21:56as components and pass this data and
- 00:21:58make it work
- 00:22:00so what I have done is I have not
- 00:22:02considered
- 00:22:04I've developed a simple UI where if I
- 00:22:07click on
- 00:22:09so KFC was displayed right like we were
- 00:22:12saying KFC
- 00:22:13what I have done is
- 00:22:18taking time to load
- 00:22:24there is any error
- 00:22:35you know why it's taking time
- 00:22:41I am using my node API here API endpoint
- 00:22:45to bypass the course
- 00:22:47so I'm not directly hitting this Wiggy
- 00:22:50API
- 00:22:53okay I got some data let me open some
- 00:22:57random question if I'm getting yeah I'm
- 00:22:59getting the restaurant so
- 00:23:04so this is the way I am displaying it so
- 00:23:09if you've seen my UI this is the UI I'm
- 00:23:11getting display
- 00:23:14I'm hitting my um node API here
- 00:23:19I've already driven the logic for that
- 00:23:21let's see that
- 00:23:22okay this is the way I'm displaying it
- 00:23:25I'm not displaying any
- 00:23:28um just restaurant information this is
- 00:23:31um uh category items it is showing some
- 00:23:35menu items so if I take KFC I can show
- 00:23:38that uh how can this be different like
- 00:23:42what I'm just showing I'll issue
- 00:23:47so I'm showing the restaurant
- 00:23:48information here just name quizzings uh
- 00:23:52rating or delivery time and inside the
- 00:23:56menu I'm just showing
- 00:23:59the category items and the items inside
- 00:24:01it
- 00:24:03and inside uh
- 00:24:06we didn't see KFC right sorry sorry oh
- 00:24:09it was Pizza Hut so I'm getting confused
- 00:24:11sorry
- 00:24:13so Pizza had uh yeah Pizza Hut was the
- 00:24:17one we were discussing I'm not showing
- 00:24:19menu Carousel and um
- 00:24:23and even the widget grid widget it's
- 00:24:27just category items
- 00:24:29so if you see uh this is my UI so inside
- 00:24:33this nested category items we had four
- 00:24:36things right like
- 00:24:38this was my category items four dips
- 00:24:41yeah so I I have kept one more uh
- 00:24:44accordion for closing this as well
- 00:24:47so this is the simply why I'm not using
- 00:24:49anything complicated and I'm not showing
- 00:24:52the other other things as well
- 00:24:54so this particular component I have
- 00:24:56reused I've already had the menu items
- 00:24:59component
- 00:25:01um I didn't modify anything in that
- 00:25:03except that earlier it was cloudinary
- 00:25:05image ID now it's just image ID is the
- 00:25:08API
- 00:25:10um
- 00:25:11if you see inside
- 00:25:13um
- 00:25:14particular item
- 00:25:16for a dish now it is coming it as uh
- 00:25:20image ID earlier it was cloudinary image
- 00:25:22ID only this change I have made in my
- 00:25:24menu items
- 00:25:25so other uh
- 00:25:27um now let's go and discuss how we can
- 00:25:31think this as a component
- 00:25:33so the whole thing I have this whole
- 00:25:36page like from here I have consider it
- 00:25:38as restaurant details is my component
- 00:25:40name inside which I have kept this as my
- 00:25:43restaurant information component till
- 00:25:45here interesting information component
- 00:25:47let me show my UI so this is restaurant
- 00:25:50information component info restaurant
- 00:25:53info
- 00:25:54um this whole this particular blog this
- 00:25:57whole thing is restaurant menu list this
- 00:25:59is the component name I have made and um
- 00:26:03and this is a restaurant item category
- 00:26:07component inside which there is menu
- 00:26:09item this is menu item this one whole
- 00:26:11thing is menu item I have looped around
- 00:26:13and showed menu items that's all so this
- 00:26:17um in the nested nested component
- 00:26:22um there is Ministry this is one nested
- 00:26:24component right in nested component this
- 00:26:27particular component this whole
- 00:26:29component is my uh nested item category
- 00:26:32component inside which there is I'm just
- 00:26:35calling the item category component in
- 00:26:37the similar way this this is similar to
- 00:26:39this item this is item category
- 00:26:42component inside which there are
- 00:26:44multiple
- 00:26:47like menu items component
- 00:26:51so
- 00:26:53if you see this like it goes like
- 00:26:55recursion right like one inside the
- 00:26:57other so this is
- 00:27:00item category which has multiple menu
- 00:27:03items
- 00:27:05in the similar way
- 00:27:07um this is an estate item category which
- 00:27:10has multiple item categories which in
- 00:27:13turn has
- 00:27:15which in turn has this is nested item so
- 00:27:19which in turn has multiple items which
- 00:27:21in turn has items menu items those this
- 00:27:25is the UI structure which I am thinking
- 00:27:27of implementing
- 00:27:29so simple one right click if you are
- 00:27:32interested and if you feel this API
- 00:27:35endpoint is challenging you can go and
- 00:27:37show all that menu Carousel and filter
- 00:27:41which filter option and offer code and
- 00:27:45everything you can show
- 00:27:47so let me show the code in QuickTime
- 00:27:50so if you understand this data structure
- 00:27:52like if the first thing which you should
- 00:27:55do is in any any time when you're going
- 00:27:57to develop you have to understand the
- 00:27:59data structure this particular payload
- 00:28:01right this data structure you should
- 00:28:03understand and you should you should
- 00:28:06um break your component to break your
- 00:28:08component hierarchy into multiple
- 00:28:10components make a whole UI screen into
- 00:28:12multiple component hierarchy and now uh
- 00:28:16which component which particular data
- 00:28:17should I pass to which component if you
- 00:28:19are clear about this you can easily code
- 00:28:21start coding now if you have like all
- 00:28:24the details like which part I should
- 00:28:25pass to which so now I have clear
- 00:28:28understanding of this now I can go and
- 00:28:30start coding
- 00:28:31like which prop which data to pass as
- 00:28:34props to which one
- 00:28:37so what you'll do we will we already
- 00:28:39have um some API uh the older API which
- 00:28:44is using uh
- 00:28:48this restaurant detail is the starting
- 00:28:50point of my code
- 00:28:52we are we have used some custom hook to
- 00:28:55fetch the API information API response
- 00:28:59so by passing this restaurant ID if I
- 00:29:02pass this restaurant ID I'll be getting
- 00:29:04the data for that particular instrument
- 00:29:06right like um
- 00:29:09all right so this API
- 00:29:14um let me open that API and uh with that
- 00:29:16particular data we were showing here now
- 00:29:18what I have modified is like I have gone
- 00:29:21gone to the user use restaurant in that
- 00:29:25after getting the data till here like in
- 00:29:27the use effect we are just calling
- 00:29:29making the API call and getting the
- 00:29:31response your interest data
- 00:29:33after that what I'm doing is I'm going
- 00:29:36what you can do is you can just pass
- 00:29:37that you know you can set that
- 00:29:39particular data as your state and pass
- 00:29:43it to that component
- 00:29:44and um do some modifications in that
- 00:29:48particular component itself so that is
- 00:29:51one way of doing all the other ways you
- 00:29:53just make all the modifications not all
- 00:29:55the modifications a part of partial
- 00:29:58modifications here and send in groups
- 00:30:01which which component needs which
- 00:30:04information so what I did is I did some
- 00:30:06modifications to the rest data RS data
- 00:30:09instead of setting it directly to my
- 00:30:10restaurant uh State I am just doing some
- 00:30:13modification and setting in my
- 00:30:15restaurant State I am returning this
- 00:30:16restraint
- 00:30:18so that uh the State restaurant so that
- 00:30:20this particular whenever this Hook is
- 00:30:23called this used restaurant Hook is
- 00:30:25called my state variable
- 00:30:27um a restaurant is sent right like that
- 00:30:30I have said here with modified data what
- 00:30:33modifications am I doing I am trying to
- 00:30:36separate out um
- 00:30:38and the the
- 00:30:39response data which I am getting as I
- 00:30:42showed like uh each will need some only
- 00:30:46part of the response so I'm just trying
- 00:30:49to separate it out so uh restaurant
- 00:30:52information part this particular part I
- 00:30:55am just sending it in this object info
- 00:30:57and all the menu related items I'm
- 00:30:59passing in in menu so that's all I'm
- 00:31:02doing for grouping it I am doing some
- 00:31:05modifications let me explain that in the
- 00:31:07similar way if you want to do that menu
- 00:31:09Carousel you can have one more object
- 00:31:11called Carousel and do what part of data
- 00:31:14you want you can pass in a similar way
- 00:31:16if you want to pass a grid widget you
- 00:31:18can pass it like widget component here
- 00:31:20and do all that
- 00:31:22so that way you can do the modifications
- 00:31:24to data so what modifications have I
- 00:31:27done to the data is info info to get
- 00:31:30this only this part of data we know
- 00:31:33already that my restaurant information
- 00:31:35is there in the cards of zero and card
- 00:31:38card info this is where my restaurant
- 00:31:40information is there right right this is
- 00:31:43like um
- 00:31:45or any type of data this is the path of
- 00:31:47the information of the restraint so I'm
- 00:31:50just passing this to my info so that uh
- 00:31:54when I use it in my information
- 00:31:57restaurant info component it will be
- 00:31:59easy for me instead of doing this every
- 00:32:02time in my component I am passing Malay
- 00:32:05info object so there you can just pass
- 00:32:07info dot name input or something oh it
- 00:32:10is easy to do so that's why I'm grouping
- 00:32:12it here itself so if you see cards of
- 00:32:15zeros having
- 00:32:21so this will have the whole this object
- 00:32:24is what I'm passing to my restaurant
- 00:32:25info component
- 00:32:28um this for now I'm just passing it to
- 00:32:31my restaurant details component inside
- 00:32:33which I'll be passing it to the
- 00:32:34restaurant info we will see that later
- 00:32:36so for now I have kept here and the
- 00:32:39similar way for the menu what I'm doing
- 00:32:41is
- 00:32:42um I am just going till the regular Dot
- 00:32:46cards so I I know that my menu item is
- 00:32:50going to be present in the cards of two
- 00:32:52I have checked in almost all the data
- 00:32:54that I have in Car 2 only I'm getting
- 00:32:57all this because card
- 00:32:59card one is always having this widget
- 00:33:02that widget part even if you have that
- 00:33:05widget or not it is always getting this
- 00:33:07I have checked with the some restaurants
- 00:33:09like um I think Burger King it didn't
- 00:33:12have that widget to display it but the
- 00:33:15data was coming card of one was having
- 00:33:18some empty object for that widget so
- 00:33:20what I understood was cards of two is
- 00:33:23only going to have my menu items so
- 00:33:25that's why I have hard-coded not hard
- 00:33:27coded I have gone to the path of cards
- 00:33:31of two and then it's group data
- 00:33:34group data and card group map regular
- 00:33:38till cards till cards I have stored it
- 00:33:41in my menu items list because here only
- 00:33:44my looping my mapping is going to start
- 00:33:48so inside the cpucc what was what was
- 00:33:51happening was like here is where the uh
- 00:33:54this this thing started like uh veg menu
- 00:33:58topics all this started right like uh
- 00:34:02zero uh zeroth element was having my veg
- 00:34:05money filter second element was having
- 00:34:07menu Carousel and the third element was
- 00:34:09having a mix of third uh following that
- 00:34:13there were a mix of um item category and
- 00:34:16nested item category license and address
- 00:34:19right like all this were coming under
- 00:34:21this particular cards so I don't want uh
- 00:34:25in my use case I didn't want to have
- 00:34:28carousels wedge filter license and
- 00:34:31address so what I did was
- 00:34:33I wanted only item category and nested
- 00:34:35item category so I'm just going and
- 00:34:38checking and filtering out only the item
- 00:34:41if it is item category and nested item
- 00:34:43category I am trying to put that in my
- 00:34:45menu and just send it to that object
- 00:34:47that's that's the logic I have done here
- 00:34:50so to my uh modify data in the menu
- 00:34:53object I am having only the details of
- 00:34:56this particular thing which I need I am
- 00:34:59not concerned about anything else so it
- 00:35:01is making easy for my component to have
- 00:35:05that data that's the thing which I have
- 00:35:06done
- 00:35:08so now if you go and see my restaurant
- 00:35:10uh details the this restaurant has the
- 00:35:13modified data which I have sent it has a
- 00:35:16menu and the info right like Reston dot
- 00:35:19menu restaurant.info so initially I'm
- 00:35:21showing some Shimmer so once I have got
- 00:35:24the data I'm I'm calling two components
- 00:35:27like one is this particular thing is
- 00:35:31nothing but I'll go to my UI this
- 00:35:33particular thing is restaurant info to
- 00:35:36this blue color and this is my
- 00:35:38restaurant menu list this whole thing is
- 00:35:40my restaurant menu list so for written
- 00:35:42uh info I don't want to pass the whole
- 00:35:44object
- 00:35:45um it's enough to pass only
- 00:35:47restraint.info here it's enough to pass
- 00:35:50District dot menu this way I can send
- 00:35:53only data that I need as props to that
- 00:35:56component
- 00:35:57so after this it's simple so restaurant
- 00:36:00info if you go and see restraint info
- 00:36:02component this will inside this I'm just
- 00:36:06getting that particular
- 00:36:07object here and I'm showing all that
- 00:36:11cloudner image name quizzings and
- 00:36:14everything this I didn't do anything
- 00:36:15this was the previous
- 00:36:17component that was I was having already
- 00:36:20so if you see now you can see the
- 00:36:23changes I made is only limited to only
- 00:36:27limited to this particular round
- 00:36:30restaurant details right like the way I
- 00:36:32pass this component information so this
- 00:36:36way the small change is made to your API
- 00:36:38you don't have to worry too much so next
- 00:36:41uh restraint menu list for instant menu
- 00:36:43list I am passing the menu menu object
- 00:36:46that I have created list in menu list
- 00:36:48what I'm doing is here is the
- 00:36:49interesting thing that's happening
- 00:36:51what I am doing is I am
- 00:36:54how will I differentiate whether it's
- 00:36:56nested here uh this component how will I
- 00:36:59differentiate whether it is
- 00:37:01nested item or item category so I I what
- 00:37:05I understood from the data structure is
- 00:37:07if it's
- 00:37:11now if it's item category I'm
- 00:37:14immediately having the title and um
- 00:37:18uh
- 00:37:19title items are array so this is this
- 00:37:24data structure if it's nested then
- 00:37:27I think this is nice to know this is
- 00:37:29also this thing
- 00:37:31uh this is also the same thing is there
- 00:37:34any Nestor third one was Nestor right
- 00:37:36like
- 00:37:38um
- 00:37:39you know third one is index of two sorry
- 00:37:43okay I think this is different uh
- 00:37:49let me check
- 00:37:53um I'm just trying to show the data
- 00:37:59this is item category
- 00:38:02this is the CPI
- 00:38:05let me try to open it again
- 00:38:11uh which component was having it these
- 00:38:14are hard right
- 00:38:15the Pizza Hut
- 00:38:20um
- 00:38:24and just minimize this
- 00:38:29so this uh zero one two three
- 00:38:33was having it
- 00:38:42okay here it is so
- 00:38:45for example let me take
- 00:38:50here it is so here there is categories
- 00:38:53so the difference I was explaining uh
- 00:38:55difference between in category item
- 00:38:58category and nested item category nested
- 00:39:00item category there was something called
- 00:39:02categories array inside which
- 00:39:05there were multiple categories item
- 00:39:08categories which had a similar thing
- 00:39:11which was similar to my item category
- 00:39:13right
- 00:39:16right you understood right like there
- 00:39:18are categories so each category is
- 00:39:21nothing but a item category
- 00:39:23so let me go here so what I understood
- 00:39:26is in uh so categories is the extra
- 00:39:30array that is present in nested item
- 00:39:32category so to differentiate I'm using
- 00:39:34this categories as the
- 00:39:36um Point uh to the print sheet so what I
- 00:39:39did is uh the menu object which I get
- 00:39:47this cards
- 00:39:50that is what I'm passing it as menu
- 00:39:51which has the filtered value of item
- 00:39:55categories and nested item categories
- 00:39:57are the only cards that I'm sending so
- 00:40:00it has either item categories or
- 00:40:02category nested item categories so to
- 00:40:05differentiate if
- 00:40:07if my uh one uh one of the object is
- 00:40:11having the uh categories as categories
- 00:40:15then it is nested uh item category so if
- 00:40:19it is having category then it is nested
- 00:40:21item category
- 00:40:23and I am passing
- 00:40:25uh that whole that particular
- 00:40:29this particular object this particular
- 00:40:31object is props to that
- 00:40:34component if it's not there if
- 00:40:37categories is not there then I can
- 00:40:39assume that it is item category and I'll
- 00:40:42just pass this as props to the item
- 00:40:43categories component so
- 00:40:46either way I am passing that particular
- 00:40:50this particular object has
- 00:40:54um
- 00:40:55props so that that's the moment the part
- 00:41:00of code I'm writing here and if it's
- 00:41:03item category what I am doing is I'm
- 00:41:05just looping and showing
- 00:41:09so your major concern should be first uh
- 00:41:12uh don't seeing this accordion you might
- 00:41:15feel it is complicated so first don't
- 00:41:18implement the accordion just Implement
- 00:41:20uh showing uh the Inner Elements
- 00:41:22directly once you have completed that
- 00:41:25particular feature then go to the
- 00:41:26accordion feature so all this accordion
- 00:41:28feature we can do later so first this
- 00:41:31part of code you can Implement so
- 00:41:33whatever uh particular item that this
- 00:41:35item is what you are getting it here
- 00:41:37these six components that you should
- 00:41:39Loop here for each item card
- 00:41:43I should Loop and show
- 00:41:45each dish is nothing but the menu item
- 00:41:49that I am going to menu item component
- 00:41:51that I'm calling
- 00:41:53so that I'll be passing what should I
- 00:41:56pass so cards
- 00:41:58cards has info and info is what uh the
- 00:42:01image name and all that particular items
- 00:42:03uh thing uh like this information is
- 00:42:07there that impose what my item menu item
- 00:42:11should be passed as props
- 00:42:14so for menu items I'm passing info car
- 00:42:18dot info
- 00:42:20discard.info I am passing it here to the
- 00:42:23menu items component this is the same
- 00:42:25item that uh this is the same component
- 00:42:27which I have already written for the old
- 00:42:29API I just modified this image ID
- 00:42:32cloudner image ID to image ID this is
- 00:42:35the same component which I have written
- 00:42:37already
- 00:42:39so here I didn't make any change just I
- 00:42:42have included created two more
- 00:42:44components item category and nested item
- 00:42:46category so item category I just
- 00:42:48explained like what I did I mapped and
- 00:42:51showed that component for the nested
- 00:42:52item category we already know
- 00:42:55category looks similar to item category
- 00:42:59so which is nothing but I have to Loop
- 00:43:03categories
- 00:43:05array and for each categories uh array
- 00:43:09element I have to call the item category
- 00:43:12again so if you see the code National
- 00:43:14category items dot categories is the
- 00:43:17array I am just looping that mapping
- 00:43:19that particular
- 00:43:21item and calling my same item category
- 00:43:25component that I've already created
- 00:43:26which is already doing all that I don't
- 00:43:29have to repeat myself to write that
- 00:43:31particular code here I'm just calling
- 00:43:33the component and passing that
- 00:43:34particular object as props to that
- 00:43:37particular component it will do all that
- 00:43:39manipulations here
- 00:43:40so now
- 00:43:42I now if you see my UI to show
- 00:43:45everything without accordion
- 00:43:48so this basic thing if it is done then
- 00:43:51I'll go and do this accordion
- 00:43:53accordingly is very simple so on click
- 00:43:55of this button it should show the items
- 00:43:57on click off if I click that button
- 00:44:00again if the arrow symbol should change
- 00:44:02and it should be hidden that's what so
- 00:44:05for that I'll be having
- 00:44:07a state variable called is visible
- 00:44:09initially it will be true and I'll be
- 00:44:12using a function to toggle it
- 00:44:15um
- 00:44:16then there will be a on click function
- 00:44:18on either this button also I can click
- 00:44:21or on title also I can click or on the
- 00:44:24arrow button also I can click if I click
- 00:44:28both
- 00:44:29also should work so that's why I have
- 00:44:31return on click function on the title
- 00:44:34also on the button also
- 00:44:37so if it is true if the state is true
- 00:44:40then I am showing up arrow and don't
- 00:44:43click of that button it should change
- 00:44:44and show the down arrow so if it's true
- 00:44:47it should show up Arrow if it's false it
- 00:44:49should show down arrow so if it's true
- 00:44:51then my menu item should be visible if
- 00:44:55it's false then it should be closed
- 00:44:57that's all the logic is so it's as
- 00:45:00simple as that
- 00:45:01so this is the basic thing which I have
- 00:45:03implemented so the main part is
- 00:45:05understanding the data and the UI that's
- 00:45:07all thank you if you have any doubts or
- 00:45:09I know the code can be improved a lot so
- 00:45:12if you have any routes you can ping me
- 00:45:14thank you
- API chanjman
- meni restoran
- UI entegasyon
- kategori meni
- kategori nèst
- kòd modulè
- adev lopman app
- backend entegasyon
- done strikti
- dévélòpman front-end