VueJS

daniel,
@daniel@roe.dev avatar

Another stream - I fell into a trap 🚨 and will be building/discussing a #vuejs integration for https://www.convex.dev with @ballingt today ...

▶️ Streaming now on https://twitch.tv/danielroe

kalvn, French
@kalvn@mastodon.xyz avatar

Les avantages de Vue par rapport à React, vus par un développeur React (cette phrase est bizarre 🤔).

Things that I like better in Vue than in React
https://jaydevm.hashnode.dev/things-that-i-like-better-in-vue-than-in-react

iamdtms,
@iamdtms@mas.to avatar
sbistvan,
@sbistvan@mastodon.social avatar

@iamdtms "Last updated 1/2021" – tehát ez még Nuxt 2 alapú, nem javaslom

iamdtms,
@iamdtms@mas.to avatar

@sbistvan Valahol el kell kezdeni, Vue 2 & Nuxt 2 to Vue 3 & Nuxt 3 migráció részletesen:
https://nuxt.com/docs/migration/overview

mirkobrombin,
@mirkobrombin@mastodon.social avatar

I have an absurd concept of fun but working on this is actually very funny.

gabs,
@gabs@fosstodon.org avatar

@mirkobrombin The dark mode is just 🤌

mirkobrombin,
@mirkobrombin@mastodon.social avatar
joe,

This past autumn, I started playing around with the Composition API, and at the October 2023 Hack and Tell, I put that knowledge into writing a “Job Tracker“. The job tracker used Vuex and Firebase Authentication to log a user in using their Google credentials. With const store = useStore() on your view, you can do something like Welcome, {{user.data.displayName}} but using this technique you can also use …

const LoginWithGoogle = async () => {<br></br>try {<br></br>await store.dispatch('loginWithGoogle')<br></br>router.push('/')<br></br>}<br></br>catch (err) {<br></br>error.value = err.message<br></br>}<br></br>}

… to kick off the authentication of the user. I want to use it to finally finish the State Parks app but I also want to use Pinia instead of Vuex, I wanted the resulting app to be a PWA, and I wanted to allow the user to log in with more than just Google credentials. So, this past week, I wrote my “Offline Vue Boilerplate“. It is meant to be a starting point for the State Parks app and a few other apps that I have kicking around in my head. I figured that this week, we should go over what I wrote.

Overview

The whole point of this “boilerplate” application was for it to be a common starting point for other applications that use Firebase for authentication and a NoSQL database. It uses:

I was using a lot of this stack for work projects, also. It is nice because Firebase is cheap and robust and you don’t need to write any server-side code. Hosting of the front-end code is “cheap-as-chips”, also. The Job Tracker is hosted using Firebase Hosting (which is free on the spark plan) and The Boilerplate App is hosted using Render, which is just as free.

Authentication

I am most proud of how I handled authentication with this app. Here is what the Pinia store looks like:

From your view, you can access {{ user }} to get to the values that came out of the single sign-on (SSO) provider (the user’s name, email address, picture, etc). For this app, I used Google and Microsoft but Firebase Authentication offers a lot of options beyond those two.

https://i0.wp.com/jws.news/wp-content/uploads/2024/03/Screenshot-2024-03-04-at-11.31.08%E2%80%AFAM.png?resize=1024%2C588&ssl=1

Adding Google is pretty easy (after all, Firebase is owned by Google) but adding Microsoft was more difficult. To get keys from Microsoft, you need to register your application with the Microsoft identity platform. Unfortunately, the account that you use for that must be an Azure account with at least a Cloud Application Administrator privileges and it can not be a personal account. The account must be associated with an Entra tenant. This means that you need to spin up an Entra tenant to register the application and get the keys.

The third SSO provider that I was tempted to add was Apple but to do that, you need to enroll in the Apple Developer program, which is not cheap.

Firebase Cloud Firestore

I have become a big fan of Firebase Cloud Firestore over the years (at least for situations where a NoSQL database makes sense). The paradigm that I started playing around with last year involved putting the Firebase CRUD functions in the composable.

Here is an example <script> block from the Job Tracker:

The author of the view doesn’t even need to know that Firebase Cloud Firestore is part of the stack. You might wonder how security is handled.

Here is what the security rule looks like behind the job tracker:

The rule is structured so that any authenticated user can create a new record but users can only read, delete, or update if they created the record.

How I made it into a Progressive Web App (PWA)

This is the easiest bit of the whole process. You just need to add vite-plugin-pwa to the dev dependencies and let it build your manifest. You do need to supply icons for it to use but that’s easy enough.

The Next Steps

I am going to be using this as a stepping-stone to build 2-3 apps but you can look forward to a few deep-dive posts on the stack, also.

Have any questions, comments, etc? Please feel free to drop a comment, below.

[ Cover photo by Barn Images on Unsplash ]

https://jws.news/2024/wrote-a-thing-with-vue-and-firebase/

#CompositionAPI #Firebase #pinia #StateParksApp #VueJs #vuex

Akryum,

Release devtools 6.6 with a refreshed UI!

https://github.com/vuejs/devtools/releases/tag/v6.6.0

rauschma,
@rauschma@fosstodon.org avatar

“Evan You, creator of Vue.js, learned a few hard lessons in the transition from version 2 to version 3 of the progressive JavaScript framework for building user interfaces […]”

Interesting insights into how to best evolve frameworks and libraries.

https://thenewstack.io/what-vues-creator-learned-the-hard-way-with-vue-3/

scy,
@scy@chaos.social avatar

A template with

<p>{{ "Some text." }}</p>

Sure, it works, but … folks, please!

scy,
@scy@chaos.social avatar

@quincy No. I can’t give any more context to protect the innocent, but the template is full of this stuff. Apparently someone saw {{ foo }} somewhere, but needed to render a static string instead of a variable’s contents, and instead of removing the braces altogether, replaced the variable with a string literal.

It’s been copy-pasted everywhere. 😔

akrennmair,
@akrennmair@mastodon.beer avatar

@scy there's always this classic meme...

YurkshireLad,
@YurkshireLad@mastodon.social avatar

I hate websites that use new fangled frameworks, and as soon as you load their home page, they prompt you with "a new version is available, do you want to load it?". No! Why aren't you automatically giving me the latest version? I know, I know, It's probably a caching thing. But what a ridiculous thing to ask a user.

partizan,

I'm trying to use generic type with vue composition API, and getting an error.

import { ref } from "vue";

function useContext&lt;T extends BaseContext&gt;(v: T) {  
 const context = ref&lt;T | null&gt;(null)  
 context.value = v  
 return {context}  
}

interface BaseContext {}  
src/main.ts:5:3 - error TS2322: Type 'T' is not assignable to type 'UnwrapRef&lt;T&gt; | null'.  

Is this a bug, or am i doing something wrong?

kkarhan,
@kkarhan@mstdn.social avatar

@partizan you typed ``` not ```` so it doesn't do ...

partizan,

@kkarhan let me check...

print("hello")  

Markdown should work with three ` whatever is this called. But mastodon uses client-side markdown render, so it works only in some clients (like Elk).

thomastospace,
@thomastospace@phpc.social avatar

Recently I started on a project at my new job. I've only worked with before.

One thing I didn't like it first, turned out to be an unexpected strength. In Angular, each component has a separate template, typescript & sass file. In Vue.js this is all inside a single file! Ugly and hard to use I thought.

Instead, it's a blessing. When a component reaches 100-150 lines, it already feels like a large component. Any larger? Time to split it up. It helps keep code clean.

pierstoval,
@pierstoval@mastodon.social avatar

@thomastospace benchmarks will matter for identical applications, especially big ones. Here, the runtime performances are less than 10% of others, so we can say that it's insignificant and even the doomed virtual DOM of react and Vue don't cause too much overhead.

However, I wish we could have a more complex application with processed CSS (like tailwind) to have more accurate comparisons, but it needs more thinking and I already spent too much time on these benches 😅

pierstoval,
@pierstoval@mastodon.social avatar

@thomastospace the conclusion to my benchmarks so far isn't about runtime performance but rather build time, size, and amount of dependencies, and in this case, Svelte has a pretty high score.

Last check which isn't shown here is the code complexity for the same features, and IMO svelte wins again. Setup is quick, and understanding of base features of the framework are straightforward, which isn't the case for Vue and React.

feudjais, French
@feudjais@eldritch.cafe avatar

Des bons tutos gratuits sur (version 2) à recommander ? :)

Merci par avance !

zyklop,
@zyklop@mas.to avatar

I need a simple for a simple web app (technically on the same level like a todo app).

I know everything about but nothing about databases.

What database/language/framework should i take for the backend?

takishan,

@zyklop easiest to set up imo is nodejs + express + postgres

If you're just making a simple application you may not need to set up a SQL database tho. I have a web app for some employees at my company and I just have nodejs update a csv file with values. Yeah it's not pretty but if it works..

zyklop,
@zyklop@mas.to avatar

@takishan

Thanks!

Actually I like your second idea here..
I worked with a php cms for decades which stored all content that was editable through the admin-login simply into markdown files (@getkirby‬) . No other dependencies than php. No database at all. That definitely has its upsides.

So then it would be frontend, backend, probably with some lib that makes it easier to customize the file(s).

iamdtms,
@iamdtms@mas.to avatar

On December 31st, 2023, 2 will reach End of Life (EOL)
2 will follow on June 30th, 2024.

mirkobrombin,
@mirkobrombin@mastodon.social avatar

The Toolkit for Bottles Next is at the beginning of its work, and this is how it currently looks without the Bottles color scheme.

https://github.com/mirkobrombin/vnt

For the "is Bottles leaving GTK?!" topic, please have a read: https://usebottles.com/blog/bottles-next-a-new-chapter/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • vuejs
  • tester
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • InstantRegret
  • Durango
  • Youngstown
  • slotface
  • thenastyranch
  • love
  • kavyap
  • tacticalgear
  • cisconetworking
  • khanakhh
  • megavids
  • ngwrru68w68
  • everett
  • osvaldo12
  • rosin
  • cubers
  • GTA5RPClips
  • normalnudes
  • modclub
  • ethstaker
  • Leos
  • anitta
  • provamag3
  • JUstTest
  • All magazines