Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
101 changes: 18 additions & 83 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,25 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
# Nuxt dev/build outputs
.output
.data
.nuxt

# Nuxt generate
.nitro
.cache
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE / Editor
.idea
# Node dependencies
node_modules

# Service worker
sw.*
# Logs
logs
*.log

# macOS
# Misc
.DS_Store
.fleet
.idea
.vscode

# Vim swap files
*.swp
# Local env files
.env
.env.*
!.env.example
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
79 changes: 67 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,75 @@
# Irregular verbs
# Nuxt 3 Minimal Starter

Simple app that try to help to study irregular verbs.
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Build Setup
## Setup

Make sure to install the dependencies:

```bash
# install dependencies
$ yarn install
# npm
npm install

# serve with hot reload at localhost:3000
$ yarn dev
# pnpm
pnpm install

# build for production and launch server
$ yarn build
$ yarn start
# yarn
yarn install

# generate static project
$ yarn generate
# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
6 changes: 6 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default defineAppConfig({
ui: {
primary: 'blue',
gray: 'cool',
},
});
12 changes: 12 additions & 0 deletions app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="min-h-screen flex flex-col">
<AppHeader class="p-2"/>

<UContainer class="flex-1 mt-5">
<NuxtPage/>
</UContainer>

<UNotifications />
<AppFooter />
</div>
</template>
3 changes: 0 additions & 3 deletions assets/css/tailwind.css

This file was deleted.

5 changes: 5 additions & 0 deletions components/AppFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<footer class="flex justify-center pt-4 space-x-2 text-sm text-gray-400">
Made with <UIcon name="i-heroicons-heart-20-solid" class="m-1 bg-red-500" /> by <a href="https://github.com/batopa" target="_blank">bato</a>
</footer>
</template>
15 changes: 15 additions & 0 deletions components/AppHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<header class="w-ful">
<div class="flex justify-between items-center mt-4">
<div class="h-14 text-xl">
<ULink to="/">Irregular verbs</ULink>
</div>
<div class="h-14">
<ULink to="/translate-verbs" active-class="text-primary">Translate verbs</ULink>
</div>
<div class="w-14 h-14">
<a href="https://github.com/batopa/irregular-verbs" target="_blank"><UIcon name="i-simple-icons-github" class="text-xl" dynamic /></a>
</div>
</div>
</header>
</template>
66 changes: 66 additions & 0 deletions composables/useVerbs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { verbsList } from '~~/config/verbs';

interface ValidationInfo {
base: boolean | null,
past: boolean | null,
participle: boolean | null,
}

export const useVerbs = () => {
const verbs = ref(verbsList);
const validation = ref<ValidationInfo>();

const extractTranslations = () => {
const translations: string[] = [];
verbs.value.forEach(v => {
translations.push(...v.translation.it);
});

return translations;
};

const validate = (translation: string, base: string, past: string, participle: string) => {
validation.value = {
base: false,
past: false,
participle: false,
};

const validVerbs = verbsList.filter(v => v.translation.it.includes(translation));

if (validVerbs.length === 0) {
return validation;
}

base = base.trim().toLowerCase();
past = past.trim().toLowerCase();
participle = participle.trim().toLowerCase();

for (const v of validVerbs) {
const baseResult = base.trim().toLowerCase() === v.base;
const pastResult = Array.isArray(v.past) ? v.past.includes(past) : past === v.past;
const participleResult = Array.isArray(v.participle) ? v.participle.includes(participle) : participle === v.participle;
if (baseResult || pastResult || participleResult) {
validation.value = {
base: baseResult,
past: pastResult,
participle: participleResult,
}

break;
}
}

return validation;
};

const findByTranslation = (translation: string) => verbsList.find(v => v.translation.it.includes(translation));

return {
verbs,
validation,
extractTranslations,
validate,
findByTranslation,
};
}
Loading