Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite with sidebase #41

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open

Rewrite with sidebase #41

wants to merge 74 commits into from

Conversation

DaeunYoon
Copy link
Collaborator

@DaeunYoon DaeunYoon commented Sep 5, 2022

closes nuxt/framework#38 & #12 & #39 & nuxt/framework#42

  • URL fixed (- instead space %20)
  • CSS package moved to Ant design
  • Inplemented suggestion endpoint with database (not used in frontend)
  • Getting mlm list from database
  • Updated README.md
  • Added footer & max width for contents

image

@DaeunYoon
Copy link
Collaborator Author

DaeunYoon commented Sep 6, 2022

I changed <Head> and other SEO codes to useHead function.
I didn't write the test yet, but when I check on and the other tags did not recognize in the test.

-> useHead doesn't work for the test either. I'll try to figure this out :)

Copy link
Owner

@BracketJohn BracketJohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove sidebase related stuff / replace it with old stuff where applicable (e.g.: main readme)

@@ -0,0 +1,41 @@
name: "\U0001F41E Bug report"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove these templates

@@ -1,18 +1,65 @@
# is-this-an-mlm
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please:

  • keep the old readme
  • in the old readme already add a line like "made with sidebase" and then link sidebase

@@ -0,0 +1,29 @@
<script setup lang="ts">
import { mlms } from '../../../library/mlms'
import TheMlm from '../../../components/TheMlm.vue'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use ~ to shoerten these imports here

@@ -0,0 +1,19 @@
import { defineEventHandler } from 'h3'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove all unused example stuff -> this is an actual project made with sidebase, actual projects would also remove / replace everything that is from sidebase but not needed

@BracketJohn
Copy link
Owner

Do you have a specific question for this early review? (:

@DaeunYoon
Copy link
Collaborator Author

DaeunYoon commented Sep 6, 2022

Do you have a specific question for this early review? (:

I wanted to make sure everything's going right with you as I thought I may take more time than you expected after wandering around the main branch.😅 Now on, I'll bring it up when there are more specific questions.

@DaeunYoon
Copy link
Collaborator Author

DaeunYoon commented Sep 6, 2022

The web seems working fine but there are a few errors still on the testing parts. 1. `useHead` function and `Head` tags both are working on the web but give out errors on test.

I thought useHead can be used like the other composable but this work on the web but gives errors on test & ts error.
ReferenceError: useHead is not defined
Cannot find name 'useHead'.ts(2304)

(nuxt use-head example: https://v3.nuxtjs.org/examples/composables/use-head/)

For Head and other tags do not give ts errors but on test they also have errors.

[Vue warn]: Failed to resolve component: Meta
    If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
  1. @inkline/inkline library has error on test ( also works fine on the web)
-> moved ant design component

For this error, I couldn't figure out much yet but I'll keep on searching for both and will update here if I find something else that works.

Copy link
Owner

@BracketJohn BracketJohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • For me the frontend does not work: "Company name" never disappears + there's an error in the console (dont know if this is related):

image

I use firefox on macos

  • the copy to clipboard button does not show up, but my browser supports it definitely!

app/app.vue Outdated
<div class="w-full border-t text-center py-2 px-6 text-sm bg-slate-100 dark:bg-dark-lightgray">
<span class="dark:text-neutral-500 text-neutral-600">made with </span>
<a href="https://github.com/sidestream-tech/sidebase" class="text-SideBase-green" target="_blank">
SideBase
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's lowercase this to stay consistent with everywhere

</div>
</template>

<style>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please always use style sacoped where possible, see https://vue-loader.vuejs.org/guide/scoped-css.html - this way style does not pollute the global website.

please fix everywhere

Copy link
Collaborator Author

@DaeunYoon DaeunYoon Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used scoped style in the other components but wanted this style to be a global style.
Which way is better to make global style if you recommend?

import { Company, companyFull } from '~/server/database/entities/Company'

const paramsSchema = z.object({
id: z.string().regex(/^\d+$/).transform(Number),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice handling to check whether id is really only numeric (:

Comment on lines 11 to 12
const params = parseParamsAs(event, paramsSchema)
return parseDataAs(Company.findOneOrThrow({ where: { id: params.id } }), companyFull)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's two ways to improve this:

a)

Suggested change
const params = parseParamsAs(event, paramsSchema)
return parseDataAs(Company.findOneOrThrow({ where: { id: params.id } }), companyFull)
const where = parseParamsAs(event, paramsSchema)
return parseDataAs(Company.findOneOrThrow({ where }), companyFull)

b)

Suggested change
const params = parseParamsAs(event, paramsSchema)
return parseDataAs(Company.findOneOrThrow({ where: { id: params.id } }), companyFull)
const params = parseParamsAs(event, paramsSchema)
return parseDataAs(Company.findOneOrThrow({ where: params }), companyFull)

Comment on lines 12 to 14
// const SUGGESTIONS_FOLDER = isProduction ? './suggestions' : '.'
// const filePath = `${SUGGESTIONS_FOLDER}/suggestions.log`
// fs.appendFileSync(filePath, `${now}; ${params.name}\n`)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can go?


const payload = { name: params.name, date: now }

console.log(params.name)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I think this can either go OR should be extended to be more informative, e.g., with a time?


@Entity()
export class Company extends Base {
@Column('text', { unique: true })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not add a ynique constraint here (unless you properly handle it in the endpoint and the frontend): many people may make similar or the same suggestions, and they should eithert all go through or the user should get good feedbackl like: "thanks, but this usggestion was already made!"

I would for now just allow all suggestions to keep the scope of this re-write on point. we can think about filtering out duplicates later on

Copy link
Collaborator Author

@DaeunYoon DaeunYoon Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I made 2 entities. - Company (for saving mlms list) - Suggestion (for saving suggestions)

I thought as people can make non-make sense suggestions, adding suggestions directly to Company could be a bit dangerous. (though suggestion endpoint is not used in frontend yet)
What do you think about this?

For now, I removed the unique constraint from Suggestion and left it to Company.

We talked about this in daily! I changed it as you said! :)

@DaeunYoon
Copy link
Collaborator Author

[ ] the copy to clipboard button does not show up, but my browser supports it definitely!

I couldn't reproduce this error.
But sometimes it takes a bit of time to load copy button as isSupported comes along with useClipboard.
(but never been longer than a few seconds for me)
If this still happens to you, I can try

  • changing supported checking method
  • replace useClipboard with previous function

@BracketJohn
Copy link
Owner

I just re-tested and I also could not reproduce the error. So consider it fixed (:

Copy link
Owner

@BracketJohn BracketJohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

README.md Outdated
@@ -15,4 +17,6 @@ Install `docker` and `docker-compose`. Then run:

## Development

For development instructions, please have a look at the `README.md`s in each individual service directory.
This website is build with [SideBase](https://github.com/sidestream-tech/sidebase) and following the basic stacks of SideBase.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This website is build with [SideBase](https://github.com/sidestream-tech/sidebase) and following the basic stacks of SideBase.
This website is build with [sidebase](https://github.com/sidestream-tech/sidebase) and following the basic stacks of sidebase.

Please user all lower case sidebase everywhere

app/index.d.ts Outdated
@@ -0,0 +1 @@
declare module 'fast-levenshtein';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

app/package.json Outdated
"@vueuse/core": "^9.2.0",
"sqlite3": "^5.0.11",
"typeorm": "^0.3.9",
"zod": "^3.18.0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be needed anymore, you can import zod from nuxt-sidebase-parse!

Copy link

@zoey-kaiser zoey-kaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, I really like the rewrite 😍! I feel like you did a great job using the tools provided by Nuxt3 to rewrite the app!

I have a few more questions outside of the review, that you could maybe help answer 🤗

  • Do you want to take a updated version of the scaffold and copy/paste your code into it?
  • Have you added a powered by sidebase reference yet (I could not find it)

<script setup lang="ts">
import type { PropType } from 'vue'
import type { Mlm } from '../types'
import TheShareGrid from './TheShareGrid.vue'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use absolute imports here?

</h3>
<p class="h4 text-2xl">
Please check out
<nuxt-link to="https://en.wikipedia.org/wiki/Multi-level_marketing">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these open in a new tab? I personally prefer when external links do not move you away from our website, as this makes us lose user retention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I updated it.

@DaeunYoon
Copy link
Collaborator Author

Thank you!

  • Do you want to take a updated version of the scaffold and copy/paste your code into it?

I'll have a look and if this wouldn't be an overkill I'll do that! :)

  • Have you added a powered by sidebase reference yet (I could not find it)

image

It's in the footer!

@DaeunYoon
Copy link
Collaborator Author

Opened new Issue #43 for updating version of the scaffold!

Copy link

@zoey-kaiser zoey-kaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit picks from now on 🤗

@@ -0,0 +1,59 @@
<script setup lang="ts">
import type { PropType } from 'vue'
import TheShareGrid from './TheShareGrid.vue'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still was not addressed. I meant we should change it to be:

Suggested change
import TheShareGrid from './TheShareGrid.vue'
import TheShareGrid from '~/components/TheShareGrid.vue'

This way, if we ever move the component, we won't have to reformat the imports (or at least it will be easier)

Edit: Only test and story files should use the relative imports, as these will always be in the same folder as the component.

<script setup lang="ts">
import type { PropType } from 'vue'
import type { SelectValue } from 'ant-design-vue/es/select'
import type { Mlm } from '../types'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we import this using

Suggested change
import type { Mlm } from '../types'
import type { Mlm } from '~/types'

<script setup lang="ts">
import { useClipboard } from '@vueuse/core'
import type { PropType } from 'vue'
import type { Mlm } from '../types'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

>
<span v-if="!showIsCopied">Copy link</span>
<span v-else class="items-center justify-center" style="display: flex">
<CheckOutlined />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use a margin here instead of the &nbsp;?

Suggested change
<CheckOutlined />
<CheckOutlined class="mr-1" />

@@ -0,0 +1,68 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we add some more infos about the project here? Like project name, github url, issue url etc.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants