Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Key Takeaways
Creates welcome screen for Vue.js Firebase real-time chat
Full Transcript
so the first step in creating this application is to create our welcome screen component and this welcome screen is going to be a simple form which asks the user for their name the enter their name press Enter that will take them to the chat component and when they add a new chat the chat component is going to know their name because of this welcome screen so first of all you'll notice I've already run NPM a run dev down here which is why we have this local development server running listening to port 8 zero eight zero so now if we go to this address we can see the dummy application here in the browser cool the next thing I'd like to do is to install materialize CSS like we did in the last chapter so we don't have to get bogged down with all of our own CSS so I've gone to materialise CSS comm forward slash getting - starting dot HTML and I'm gonna copy the mini 5 CSS library right here just the top one we don't need the JavaScript and I'll paste this inside our index dot HTML file right here just underneath this meta tag now we also want Google icons so let's scroll down here until we see HTML setup then we want to grab this thing right here Google icon fonts so if we copy that and also paste that inside index dot HTML just above materialised CSS so if we save that now now we can use these different utility classes and icons inside our project cool ok then so now let's start to create this component I'm going to cross off the terminal it was still running the background and inside components instead of hello world we'll rename this to welcome so welcome like so now we've renamed that component we're going to see this big error over here and that's because the router file is looking for the hello world dot view component and we've just renamed that so it doesn't exist anymore so let's update our router file as well so if I just right click on hello world and go to change all occurrences I'll change this to welcome instead so one two three four now we're loading in the welcome screen or the Welcome component when a user goes to just /so if we save this we should now see the Welcome component which is still this thing right here but if we go to the Welcome component now we can get rid of all of this dummy HTML we don't need that anymore get rid of that we also don't need this data message and we can rename this to welcome and finally let's get rid of this CSS down here I also don't want to use the scoped keyword right there either okay so now we have this basic component for our welcome screen the first thing we'll do is change this class right here to welcome and we'll also add a class of container which is that utility class from materialise which brings everything into a central column now the next thing we'll do is a div with a class of card that is going to make a little card on this screen which is where we'll place our form so inside this card we want some card content so again another div with a class of card - content this time and we'll also give this another class called sensor aligned so that's going to align everything inside this to the center all right then so inside this div what would we like to output well we'd like an h2 saying welcome or something like that and also a form so let's do the h2 first of all I'll give this a class of teal text which is kind of like a bluey green and then inside that we'll say welcome underneath the h2 we'll do a form and we don't need an action but what we will do is attach an event to this a submit event so we'll say at submit we want to prevent the default action which will refresh the page so we'll say dot prevent to do that set that equal to some function we'll call this function enter chats now we've not created that function yet we'll do it after we've done our template so inside the forum now first of all we want a label and this label is going to be for the name so we'll say enter your name like so and then underneath that we need an input field which will be of type next the name of this input field is going to be named and the v-model is going to be equal to name so when a user types into this input field we want to sync it with a name property over here on our object so let's add a name property down there and to begin with we'll set it to null when they first land on the screen but as a user types into this field it's going to update over here as well okay finally we need a button for user to click to enter the chat to submit this form this button will have a class equal to beat yet I'll see you til atte class from aterial eyes and also teal to give it that same color as this thing over here by the way whenever we say teal text that does the text color whenever we just do teal or the color itself that does the background color okay that's the difference between these two teal text and teal okay so we want to say enter chat in here so now when a user is entering in a name into this input field we're storing it right here when they click on this button it's gonna fire this thing over here and to chat prevent the default action but we need to create this enter chat method to grab the name that that user has entered so underneath data over here let's create that method we do it in the methods property which is an object and inside this is going to be called enter chat this method okay so in here what do we want to do well eventually we want to take them to the chat screen the chat component so redirect them and we also want to pass through the name that they've entered right here which will be stored on this object but for now all we'll do is console dot log the name that they've entered into that field so console dot log and we'll say this dot name okay so if we save this now and go to the browser we should see this welcome screen now there's a couple of things I want to do first of all I want to take off this logo and I also want to neaten this chat welcome screen up a little bit as well so first of all let's go to the component because that's where the logo is up top view and we can delete that racket while we're in it let's get rid of all this style as well we don't need that okay save that and we should see the logo disappear cool now we just want to make this look a bit neater as well so then let's go down to our style tags inside the Welcome component down here and just add in a couple of rules first of all we'll get the Welcome div which is a class of welcome this thing at the very top and what we'd like to do for this div is give it a max width first of all or 400 pixels because I did think it was a little bit wide on the screen so I'm max with a 400 pixels now we're also going to push it down from the top of the window by saying margin top is 100 pixels will also target the h2 inside here because I think we just need to address the text size so whoops let's just zoom that down again we'll say welcome h2 and then inside here we'll give this a font size of 3mm let's save that and see how it looks so far okay looking a bit better but I'd like to add a little margin between the bottom here and the input field so finally it will just say welcome button and then inside here margin is going to be 30 pixels top and bottom also left and right okay so save that and this looks a lot better now so let's just make sure it works we'll inspect the element so we can go to the console over here and play this and if we type in a name now and press Enter we should see that logged to the console which we do cool Mariam so now we have this welcome screen the next step is to grab this name right here redirect the user to a chat component with that name so we'll address that in the next video
Original Description
FULL COURSE LINK - https://www.udemy.com/build-web-apps-with-vuejs-firebase/?couponCode=NINJAYT18
Use Code NINJAYT18 for discount. Discount should already be applied when using the link above!
See the full course for a full Vue.js tutorial, including building 3 projects with Firebase.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Net Ninja · Net Ninja · 45 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
▶
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
GraphQL Tutorial #5 - Express App Setup
Net Ninja
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
GraphQL Tutorial #8 - Root Query
Net Ninja
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
GraphQL Tutorial #12 - Author Type
Net Ninja
GraphQL Tutorial #13 - Type Relations
Net Ninja
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
GraphQL Tutorial #18 - Mutations
Net Ninja
GraphQL Tutorial #19 - More on Mutations
Net Ninja
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
GraphQL Tutorial #23 - Create React App
Net Ninja
GraphQL Tutorial #24 - Book List Component
Net Ninja
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
GraphQL Tutorial #28 - Add Book Component
Net Ninja
GraphQL Tutorial #29 - External Query File
Net Ninja
GraphQL Tutorial #30 - Updating Component State
Net Ninja
GraphQL Tutorial #31 - Composing Queries
Net Ninja
GraphQL Tutorial #32 - query variables
Net Ninja
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
GraphQL Tutorial #34 - Book Details Component
Net Ninja
GraphQL Tutorial #36 - Styling the App
Net Ninja
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
Updated Vue & Firebase Course (Udemy)
Net Ninja
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja
Related AI Lessons
⚡
⚡
⚡
⚡
X now offers an MCP server to make its platform easier for AI tools to use
TechCrunch AI
n8n Automation Repurpose Video Content: The 2025 Production Guide
Dev.to AI
You’re Still Paying $200/Month for AI Tools You Could Replace With a Free Local Setup Tonight
Medium · Data Science
Top 10 AI Tools Every College Student Should Know in 2026
Medium · AI
🎓
Tutor Explanation
DeepCamp AI