diff --git a/nuxt-pinia-tailwind/README.md b/nuxt-pinia-tailwind/README.md index 715ef1126..20e6ca461 100644 --- a/nuxt-pinia-tailwind/README.md +++ b/nuxt-pinia-tailwind/README.md @@ -53,6 +53,7 @@ Open the project root directory in your terminal and navigate to the `nuxt-pinia cd nuxt-pinia-tailwind yarn ``` + ## Live Demo This demo app gets deployed to Netlify on changes to the `main` branch. diff --git a/nuxt-pinia-tailwind/components/PrivacyBadge/PrivacyBadge.vue b/nuxt-pinia-tailwind/components/PrivacyBadge/PrivacyBadge.vue index 73894ca78..ecab42819 100644 --- a/nuxt-pinia-tailwind/components/PrivacyBadge/PrivacyBadge.vue +++ b/nuxt-pinia-tailwind/components/PrivacyBadge/PrivacyBadge.vue @@ -1,6 +1,5 @@ - diff --git a/nuxt-pinia-tailwind/components/icons/GithubLogo/GithubLogo.vue b/nuxt-pinia-tailwind/components/icons/GithubLogo.vue similarity index 97% rename from nuxt-pinia-tailwind/components/icons/GithubLogo/GithubLogo.vue rename to nuxt-pinia-tailwind/components/icons/GithubLogo.vue index 3ba496b64..5f49fbf4f 100644 --- a/nuxt-pinia-tailwind/components/icons/GithubLogo/GithubLogo.vue +++ b/nuxt-pinia-tailwind/components/icons/GithubLogo.vue @@ -4,7 +4,7 @@ viewBox="0 0 120.78 117.79" :class="customClass" > - gh-logo-lg-dark-bg + Github Logo - diff --git a/nuxt-pinia-tailwind/components/icons/OfficeBuildingIcon.vue b/nuxt-pinia-tailwind/components/icons/OfficeBuildingIcon.vue new file mode 100644 index 000000000..68be87e19 --- /dev/null +++ b/nuxt-pinia-tailwind/components/icons/OfficeBuildingIcon.vue @@ -0,0 +1,23 @@ + + + diff --git a/nuxt-pinia-tailwind/components/icons/GithubLogo/StarIcon.vue b/nuxt-pinia-tailwind/components/icons/StarIcon.vue similarity index 97% rename from nuxt-pinia-tailwind/components/icons/GithubLogo/StarIcon.vue rename to nuxt-pinia-tailwind/components/icons/StarIcon.vue index 274bcfb82..0c34a2000 100644 --- a/nuxt-pinia-tailwind/components/icons/GithubLogo/StarIcon.vue +++ b/nuxt-pinia-tailwind/components/icons/StarIcon.vue @@ -21,7 +21,7 @@ export default { customClass: { type: String, required: false, - default: 'h-6', + default: 'h-4', }, }, }; diff --git a/nuxt-pinia-tailwind/components/icons/TwitterLogo.vue b/nuxt-pinia-tailwind/components/icons/TwitterLogo.vue new file mode 100644 index 000000000..1ab3af25c --- /dev/null +++ b/nuxt-pinia-tailwind/components/icons/TwitterLogo.vue @@ -0,0 +1,18 @@ + + + diff --git a/nuxt-pinia-tailwind/components/icons/UsersIcon.vue b/nuxt-pinia-tailwind/components/icons/UsersIcon.vue new file mode 100644 index 000000000..c4e4b7caa --- /dev/null +++ b/nuxt-pinia-tailwind/components/icons/UsersIcon.vue @@ -0,0 +1,22 @@ + + + diff --git a/nuxt-pinia-tailwind/layouts/LoggedIn.vue b/nuxt-pinia-tailwind/layouts/LoggedIn.vue new file mode 100644 index 000000000..2b7efda37 --- /dev/null +++ b/nuxt-pinia-tailwind/layouts/LoggedIn.vue @@ -0,0 +1,6 @@ + diff --git a/nuxt-pinia-tailwind/package.json b/nuxt-pinia-tailwind/package.json index 0e755299b..9c7e14aa6 100644 --- a/nuxt-pinia-tailwind/package.json +++ b/nuxt-pinia-tailwind/package.json @@ -56,6 +56,7 @@ "@testing-library/jest-dom": "^5.16.4", "@testing-library/vue": "5", "@types/jest": "^27.5.1", + "@vue/runtime-dom": "^3.2.40", "@vue/test-utils": "^1.3.0", "babel-core": "7.0.0-bridge.0", "babel-jest": "^27.4.4", diff --git a/nuxt-pinia-tailwind/pages/_user/index.vue b/nuxt-pinia-tailwind/pages/_user/index.vue new file mode 100644 index 000000000..972b315b3 --- /dev/null +++ b/nuxt-pinia-tailwind/pages/_user/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/nuxt-pinia-tailwind/pages/index.vue b/nuxt-pinia-tailwind/pages/index.vue index 91a7e8cbb..9766f2beb 100644 --- a/nuxt-pinia-tailwind/pages/index.vue +++ b/nuxt-pinia-tailwind/pages/index.vue @@ -1,19 +1,16 @@ @@ -23,6 +20,7 @@ import Vue from 'vue'; export default Vue.extend({ name: 'IndexPage', + layout: 'LoggedIn', setup() { const { $auth } = useContext(); diff --git a/nuxt-pinia-tailwind/pages/sign-in/Signin.test.ts b/nuxt-pinia-tailwind/pages/sign-in/Signin.test.ts index e338cb5ff..06a508801 100644 --- a/nuxt-pinia-tailwind/pages/sign-in/Signin.test.ts +++ b/nuxt-pinia-tailwind/pages/sign-in/Signin.test.ts @@ -6,14 +6,14 @@ describe('', () => { it('Should redirect the user when clicking at the signin button', async () => { // Arrange const STARTER_API_URL = - process.env.STARTER_API_URL || 'https://api.starter.dev/api'; + process.env.STARTER_API_URL || + 'https://api.starter.dev/.netlify/functions/server/api'; const BASE_URL = process.env.BASE_URL || 'http://localhost:3000'; // Redefine window.location in order to mock it const windowLocation = JSON.stringify(window.location); - global.window = Object.create(window); - Object.defineProperty(window, 'location', { + Object.defineProperty(globalThis, 'location', { writable: true, value: JSON.parse(windowLocation), }); diff --git a/nuxt-pinia-tailwind/schemes/authScheme.ts b/nuxt-pinia-tailwind/schemes/authScheme.ts index eeb395cff..54242698c 100644 --- a/nuxt-pinia-tailwind/schemes/authScheme.ts +++ b/nuxt-pinia-tailwind/schemes/authScheme.ts @@ -35,7 +35,6 @@ export default class CustomLoginScheme extends LocalScheme { }; const getOrgs = this.$auth.requestWith(this.name, orgsEndpoint); - // // Fetch stars const starsEndpoint: HTTPRequest = { @@ -44,7 +43,6 @@ export default class CustomLoginScheme extends LocalScheme { }; const getStars = this.$auth.requestWith(this.name, starsEndpoint); - // const [{ data: orgs }, { data: stars }] = await Promise.all([ getOrgs, @@ -55,6 +53,8 @@ export default class CustomLoginScheme extends LocalScheme { ...user, orgs, stars, + orgs_count: orgs.length, + stars_count: stars.length, }; this.$auth.setUser(customUser); diff --git a/nuxt-pinia-tailwind/tsconfig.node.json b/nuxt-pinia-tailwind/tsconfig.node.json new file mode 100644 index 000000000..9057a0515 --- /dev/null +++ b/nuxt-pinia-tailwind/tsconfig.node.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "composite": true, + "module": "esnext", + "moduleResolution": "node" + }, + "include": ["vite.config.ts"], + "vueCompilerOptions": { + "experimentalCompatMode": 2, // delete after migrating to nuxt3 + "experimentalTemplateCompilerOptions": { + "compatConfig": { + "MODE": 2 + } // delete after migrating to nuxt3 + } + } +} diff --git a/nuxt-pinia-tailwind/types/user/interfaces.ts b/nuxt-pinia-tailwind/types/user/interfaces.ts index ee40e4b99..6243806b7 100644 --- a/nuxt-pinia-tailwind/types/user/interfaces.ts +++ b/nuxt-pinia-tailwind/types/user/interfaces.ts @@ -55,6 +55,7 @@ export interface IUserApiResponse { email: string; hireable: boolean; bio: string; + website_url: string; twitter_username: string; public_repos: number; public_gists: number; @@ -65,6 +66,6 @@ export interface IUserApiResponse { } export interface IUser extends IUserApiResponse { - orgs: IUserOrg[]; - stars: IUserStar[]; + orgs_count: number; + stars_count: number; } diff --git a/nuxt-pinia-tailwind/yarn.lock b/nuxt-pinia-tailwind/yarn.lock index 45a9a1cc2..e4e7d6ae0 100644 --- a/nuxt-pinia-tailwind/yarn.lock +++ b/nuxt-pinia-tailwind/yarn.lock @@ -4123,15 +4123,39 @@ estree-walker "^2.0.2" magic-string "^0.25.7" -"@vue/shared@3.2.33": +"@vue/reactivity@3.2.40": + version "3.2.40" + resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.40.tgz#ae65496f5b364e4e481c426f391568ed7d133cca" + integrity sha512-N9qgGLlZmtUBMHF9xDT4EkD9RdXde1Xbveb+niWMXuHVWQP5BzgRmE3SFyUBBcyayG4y1lhoz+lphGRRxxK4RA== + dependencies: + "@vue/shared" "3.2.40" + +"@vue/runtime-core@3.2.40": + version "3.2.40" + resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.40.tgz#e814358bf1b0ff6d4a6b4f8f62d9f341964fb275" + integrity sha512-U1+rWf0H8xK8aBUZhnrN97yoZfHbjgw/bGUzfgKPJl69/mXDuSg8CbdBYBn6VVQdR947vWneQBFzdhasyzMUKg== + dependencies: + "@vue/reactivity" "3.2.40" + "@vue/shared" "3.2.40" + +"@vue/runtime-dom@^3.2.40": + version "3.2.40" + resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.40.tgz#975119feac5ab703aa9bbbf37c9cc966602c8eab" + integrity sha512-AO2HMQ+0s2+MCec8hXAhxMgWhFhOPJ/CyRXnmTJ6XIOnJFLrH5Iq3TNwvVcODGR295jy77I6dWPj+wvFoSYaww== + dependencies: + "@vue/runtime-core" "3.2.40" + "@vue/shared" "3.2.40" + csstype "^2.6.8" + +"@vue/shared@3.2.33", "@vue/shared@^3.2.26": version "3.2.33" resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.2.33.tgz" integrity sha512-UBc1Pg1T3yZ97vsA2ueER0F6GbJebLHYlEi4ou1H5YL4KWvMOOWwpYo9/QpWq93wxKG6Wo13IY74Hcn/f7c7Bg== -"@vue/shared@^3.2.26": - version "3.2.39" - resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.2.39.tgz" - integrity sha512-D3dl2ZB9qE6mTuWPk9RlhDeP1dgNRUKC3NJxji74A4yL8M2MwlhLKUC/49WHjrNzSPug58fWx/yFbaTzGAQSBw== +"@vue/shared@3.2.40": + version "3.2.40" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.40.tgz#e57799da2a930b975321981fcee3d1e90ed257ae" + integrity sha512-0PLQ6RUtZM0vO3teRfzGi4ltLUO5aO+kLgwh4Um3THSR03rpQWLTuRCkuO5A41ITzwdWeKdPHtSARuPkoo5pCQ== "@vue/test-utils@^1.1.0", "@vue/test-utils@^1.3.0": version "1.3.0" @@ -6664,6 +6688,11 @@ csstype@^2.5.7: resolved "https://registry.npmjs.org/csstype/-/csstype-2.6.20.tgz" integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA== +csstype@^2.6.8: + version "2.6.21" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.21.tgz#2efb85b7cc55c80017c66a5ad7cbd931fda3a90e" + integrity sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w== + csstype@^3.0.2: version "3.0.11" resolved "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz"