Skip to content
Snippets Groups Projects
Commit 84d448fc authored by Emmanuel Salomon's avatar Emmanuel Salomon :fist:
Browse files

Push to gitlab :rocket:

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 994 additions and 0 deletions
.babelrc 0 → 100644
{
"env": {
"test": {
"plugins": [
[
"module-resolver",
{
"root": ["."],
"alias": {
"@": ".",
"~": "."
}
}
]
]
}
}
}
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: 'babel-eslint',
},
extends: [
'@nuxtjs',
'prettier',
'prettier/vue',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
],
plugins: ['prettier'],
// add your custom rules here
rules: {
'vue/no-v-html': 'off',
},
}
# monnaie-libre.fr
fake-*.*
# 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
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp
{
"semi": false,
"arrowParens": "always",
"singleQuote": true
}
{
"i18n-ally.localesPaths": "locales",
"i18n-ally.keystyle": "nested"
}
\ No newline at end of file
README.md 0 → 100644
## Site [monnaie-libre.fr](https://monnaie-libre.fr)
> Ceci est le dépôt du générateur du site.
> Pour éditer son contenu, passez par l'admin du site, ou modifier directement les fichiers dans le dépôt du contenu.
### Build Setup
```bash
## install dependencies
$ yarn install
## serve with hot reload at localhost:3000
$ yarn dev
## build for production and launch server
$ yarn build
$ yarn start
## generate static project
$ yarn generate
```
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
## Le back office (netlify)
### Lancer le back office (netlify)
yarn admin
Puis aller sur http://localhost:3000/admin
### Fichier de configuration
- `static/admin/config.yml` Paramètres de netlify
- `static/admin/index.html` HTML de la page d'administration de netlify
## Design
### Storybook
Idée abandonnée. J'ai installé, configuré et testé. Mais c'est compliqué, et finalement pas super intégré pour vue.js...
### Afficher toutes les `class` de tailwindcss
http://localhost:3000/_tailwind/
Sur cette page, vous pouvez copier une class css en cliquant sur le nom, ou maj+click pour copier plusieurs class.
### Icônes
https://fontawesome.com/icons?m=free
## Docs
- @nuxt/content https://content.nuxtjs.org/fr et https://nuxtjs.org/docs/2.x/directory-structure/content/
- @nuxt/svg https://github.com/nuxt-community/svg-module
- @nuxt/composition-api https://composition-api.nuxtjs.org/
Voir aussi`nuxt.config.js` pour la doc d'autres modules...
## Tailwindcss et Vue
https://tailwindcss.com/
https://play.tailwindcss.com/
### Templates et ressources
https://vuetailwind.com/
https://tailblocks.cc/
https://tailwindcomponents.com/
https://www.tailwindtoolbox.com/
https://mertjf.github.io/tailblocks/
http://blocks.wickedtemplates.com/
https://www.creative-tim.com/learning-lab/tailwind-starter-kit/documentation/download
### Divers
https://maizzle.com
https://vuetensils.stegosource.com/introduction.html
## Generate fake data
Modifier le fichier `test/generate-md-files.js` puis :
node test/generate-md-files.js
Aide faker.js: https://cdn.rawgit.com/Marak/faker.js/master/examples/browser/index.html
# Docker
**Run the nuxt build site in a docker environment**
If you don't got it, run the following command to get the Nginx Docker image:
docker pull nginx
This downloads all the necessary components for the container. Docker will cache these, so when we run the container we don’t need to download the nginx image(s) each time.
Then start our Nginx Docker container with this command:
dk run --rm -d -v $(pwd)/dist:/usr/share/nginx/html -p 80:80 nginx:alpine
Go to [](http://localhost/) !
You can change the port. In the command above, replace `80:80` by `4000:80` and go to [](http://localhost:4000/)
# CI Gitlab
https://blog.logrocket.com/how-to-auto-deploy-a-vue-application-using-gitlab-ci-cd-on-ubuntu/
# TODO
## A installer
- Statistiques open source node.js/graphql : https://github.com/electerious/Ackee
- Flux rss/atom : https://content.nuxtjs.org/fr/advanced#int%C3%A9gration-avec-nuxtjsfeed
## A corriger quand ce sera fixé
- Remove postcss 7 when nuxt/tailwindcss will be updated (See [here](https://tailwindcss.nuxtjs.org/setup#tailwind-2))
- Remove `resolutions` in package.json (See [here](https://github.com/nuxt/nuxt.js/issues/8639#issuecomment-767552372))
export default async function (to, from, savedPosition) {
if (savedPosition) {
return savedPosition
}
const findEl = (hash, x) => {
return (
document.querySelector(hash) ||
new Promise((resolve, reject) => {
if (x > 50) {
return resolve()
}
setTimeout(() => {
resolve(findEl(hash, ++x || 1))
}, 100)
})
)
}
if (to.hash) {
const el = await findEl(to.hash)
if ('scrollBehavior' in document.documentElement.style) {
return window.scrollTo({ top: el.offsetTop, behavior: 'smooth' })
} else {
return window.scrollTo(0, el.offsetTop)
}
}
return { x: 0, y: 0 }
}
# ASSETS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
/* purgecss start ignore */
@import 'tailwindcss/base';
@import 'tailwindcss/components';
/* purgecss end ignore */
@import 'tailwindcss/utilities';
/* helper for development only */
.nuxt-content-container {
background: linear-gradient(90deg, transparent 90%, #ffff0030);
}
svg:not(:root).svg-inline--fa {
overflow: visible;
}
.svg-inline--fa {
display: inline-block;
height: 1em;
overflow: visible;
vertical-align: -0.125em;
}
/* For dark mode */
html {
transition: background-color 0.4s, color 0.1s;
}
.dark {
@apply bg-dark;
@apply text-white;
}
/* Loader */
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
.loading-state {
position: relative;
overflow: hidden;
}
.loading-state:before {
content: '';
box-sizing: border-box;
position: absolute;
background-color: inherit;
width: 100%;
height: 100%;
display: block;
z-index: 1;
top: 0;
left: 0;
}
.loading-state:after {
content: '';
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
margin-top: -10px;
margin-left: -10px;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.45);
border-top-color: inherit;
animation: spinner 0.6s linear infinite;
z-index: 2;
}
/**
* Transitions
*/
.list-enter-active,
.list-leave-active,
.list-move {
transition: 250ms cubic-bezier(0.59, 0.12, 0.34, 0.95);
transition-property: opacity;
}
.list-enter {
opacity: 0;
}
.list-enter-to {
opacity: 1;
}
.list-leave-active {
}
.list-leave-to {
opacity: 0;
}
module.exports = () => {
return {
require: ['./test/helpers/ava.setup.js'],
ignoredByWatcher: ['!**/*.{js,vue}'],
babel: true,
tap: true,
verbose: true,
color: true
}
}
# COMPONENTS
**This directory is not required, you can delete it if you don't want to use it.**
The components directory contains your Vue.js Components.
_Nuxt.js doesn't supercharge these components._
<template>
<nav class="text-black font-bold mt-2" aria-label="Breadcrumb">
<ol class="list-none p-0 inline-flex">
<a
v-if="back"
class="group py-2"
href="#"
:class="items.length && 'pr-4 border-r mr-4'"
@click="$router.back()"
>
<fa icon="chevron-left" class="text-gray-300 mr-3 transition" />
<span class="text-gray-400 group-hover:text-hover">
{{ $t('goBack') }}
</span>
</a>
<li v-for="(item, index) in items" :key="index" class="flex items-center">
<nuxt-link
:to="item.path"
class="hover:text-hover py-2"
:class="
index !== items.length - 1
? 'text-gray-400'
: 'text-gray-600 font-extralight select-all'
"
>
{{ item.title }}
</nuxt-link>
<fa
v-if="index !== items.length - 1"
icon="chevron-right"
class="text-gray-300 mx-3"
/>
</li>
</ol>
</nav>
</template>
<script>
export default {
props: {
items: {
type: Array,
default: () => [],
},
back: {
type: Boolean,
default: false,
},
},
}
</script>
<style lang="postcss" scoped>
.group:hover >>> .fa-chevron-left {
transform: translateX(-0.5em);
}
</style>
<template>
<t-toggle v-model="mode" value="dark" unchecked-value="light" variant="dark">
<fa
slot="unchecked"
icon="sun"
class="transform scale-125 text-yellow-400"
/>
<fa slot="checked" icon="moon" class="transform scale-110 text-gray-100" />
</t-toggle>
</template>
<script>
export default {
name: 'AppDarkMode',
data() {
return {
mode: this.$colorMode.value,
}
},
watch: {
mode: {
handler(newVal) {
this.$colorMode.preference = newVal
},
},
'$colorMode.value': {
handler(newVal) {
this.mode = newVal
},
},
},
}
</script>
<template>
<div>
<Regions id="regionSVG" ref="regionSVG" class="text-gray-500" />
<span
v-show="hovered"
id="tooltip-mini-map"
class="bg-white fixed pointer-events-none p-1 shadow-lg rounded text-xs bg-opacity-90 dark:bg-gray-700"
>
{{ hovered && hovered.name }}
</span>
</div>
</template>
<script>
import Regions from '~/static/img/regions.svg?inline'
const regions = {
Alsace: {
id: 77,
name: 'Alsace',
color: '#F7941D',
},
Aquitaine: {
id: 66,
name: 'Aquitaine',
color: '#B3B5B4',
},
Auvergne: {
id: 59,
name: 'Auvergne',
color: '#652D90',
},
'Basse-normandie': {
id: 78,
name: 'Basse-Normandie',
color: '#12A89D',
},
Bourgogne: {
id: 50,
name: 'Bourgogne',
color: '#0088CC',
},
Bretagne: {
id: 29,
name: 'Bretagne',
color: '#BF1E2E',
},
Centre: {
id: 61,
name: 'Centre',
color: '#9EB83B',
},
'Champagne-ardenne': {
id: 79,
name: 'Champagne-Ardenne',
color: '#ff9999',
},
Corse: {
id: 62,
name: 'Corse',
color: '#00cc00',
},
'Franche-comte': {
id: 80,
name: 'Franche-Comté',
color: '#0099cc',
},
Guadeloupe: {
id: 55,
name: 'Guadeloupe',
color: '#cc6600',
},
Guyane: {
id: 70,
name: 'Guyane',
color: '#558000',
},
'Haute-normandie': {
id: 81,
name: 'Haute-Normandie',
color: '#e6e600',
},
'Ile-de-france': {
id: 82,
name: 'Ile-de-France',
color: '#b300b3',
},
'La-reunion': {
id: 72,
name: 'La Réunion',
color: '#0088cc',
},
'Languedoc-roussillon': {
id: 83,
name: 'Languedoc-Roussillon',
color: '#8cd98c',
},
Limousin: {
id: 84,
name: 'Limousin',
color: '#ffccdd',
},
Lorraine: {
id: 85,
name: 'Lorraine',
color: '#3399ff',
},
Martinique: {
id: 71,
name: 'Martinique',
color: '#2a8000',
},
Mayotte: {
id: 86,
name: 'Mayotte',
color: '#FF9999',
},
'Midi-pyrenees': {
id: 87,
name: 'Midi-Pyrénées',
color: '#808281',
},
'Nord-pas-de-calais': {
id: 88,
name: 'Nord-Pas-de-Calais',
color: '#00CC00',
},
'Pays-de-la-loire': {
id: 68,
name: 'Pays de la Loire',
color: '#0088CC',
},
Picardie: {
id: 54,
name: 'Picardie',
color: '#F1592A',
},
'Poitou-charentes': {
id: 89,
name: 'Poitou-Charentes',
color: '#652D90',
},
'Provence-alpes-cote-dazur': {
id: 69,
name: "Provence-Alpes-Côte d'Azur",
color: '#BF1E2E',
},
'Rhone-alpes': {
id: 76,
name: 'Rhône-Alpes',
color: '#E6E600',
},
Afrique: {
id: 38,
name: 'Afrique',
color: '#3AB54A',
},
Belgique: {
id: 40,
name: 'Belgique',
color: '#FFCCDD',
},
Canada: {
id: 90,
name: 'Canada',
color: '#12A89D',
},
Espagne: {
id: 91,
name: 'Espagne',
color: '#3399FF',
},
Suisse: {
id: 46,
name: 'Suisse',
color: '#ED207B',
},
Allemagne: {
id: 92,
name: 'Allemagne',
color: '#3AB54A',
},
'Catalunya-andorra': {
id: 93,
name: 'Catalunya-Andorra',
color: '#0088CC',
},
Asie: {
id: 102,
name: 'Asie',
color: '#E6E600',
},
}
export default {
name: 'MiniMap',
components: {
Regions,
},
data() {
return {
hovered: null,
}
},
mounted() {
const regionsPath = this.$refs.regionSVG.querySelectorAll('path')
const tooltip = this.$el.querySelector('#tooltip-mini-map')
this.$refs.regionSVG.addEventListener('mousemove', (evt) => {
tooltip.style.left = evt.clientX + 15 + 'px'
tooltip.style.top = evt.clientY - 20 + 'px'
})
regionsPath.forEach((region) => {
if (regions[region.id]) region.style.fill = regions[region.id].color
region.addEventListener('mouseenter', (evt) => {
this.hovered = regions[evt.target.id]
})
region.addEventListener('mouseleave', (evt) => {
this.hovered = null
})
region.addEventListener('click', (evt) => {
window.open(
`https://forum.monnaie-libre.fr/c/${regions[evt.target.id].id}`,
'_blank'
)
})
})
},
}
/*
fetch(`https://forum.monnaie-libre.fr/categories.json`)
.then(response => response.json())
.then(data => console.log(data))
ID des groupes locaux du forum :
[77,66,59,78,50,29,61,79,62,80,55,70,81,82,72,83,84,85,71,86,87,88,68,54,89,69,76,38,40,90,91,46,92,93,102]
const capitalize = (s) => {
if (typeof s !== 'string') return ''
return s.charAt(0).toUpperCase() + s.slice(1)
}
let regions = {}
let timer = ms => new Promise(res => setTimeout(res, ms))
async function load () {
for (var i = 0; i < temp1.length; i++) {
await fetch(`https://forum.monnaie-libre.fr/c/${temp1[i]}/show.json`)
.then(response => response.json())
.then(data => regions[capitalize(data.category.slug)] = {id: data.category.id, name:data.category.name, color: '#'+data.category.color})
await timer(3000);
}
}
await load();
copy(regions)
Alsace: '#F7941D',
Aquitaine: '#B3B5B4',
Basse-Normandie: '#12A89D',
Bretagne: '#BF1E2E',
Bourgogne: '#0088CC',
Auvergne: '#652D90',
Centre: '#9EB83B',
Champagne-Ardenne: '#ff9999',
Corse: '#00cc00',
Guyane: '#558000',
Guadeloupe: '#cc6600',
Franche-Comté: '#0099cc',
Haute-Normandie: '#e6e600',
Ile-de-France: '#b300b3',
La Réunion: '#0088cc',
Picardie: '#F1592A',
Allemagne: '#3AB54A',
*/
</script>
<style lang="postcss" scoped>
#regionSVG >>> path {
opacity: 0.6;
transition: opacity ease 150ms;
cursor: pointer;
}
#regionSVG >>> path:hover {
opacity: 1;
}
</style>
<template>
<div class="relative h-full">
<t-input
ref="inputIcon"
:type="type"
class="pl-12"
:class="inputClass"
v-bind="$attrs"
v-on="$listeners"
/>
<div class="absolute flex items-center ml-3 bottom-0 top-0">
<fa slot="icon" :icon="icon" :class="iconClass" />
</div>
</div>
</template>
<script>
export default {
name: 'TInputIcon',
props: {
type: {
type: String,
default: 'text',
},
icon: {
type: String,
default: null,
},
iconClass: {
type: String,
default: null,
},
inputClass: {
type: String,
default: null,
},
focus: {
type: Boolean,
default: false,
},
},
mounted() {
if (this.focus) this.$refs.inputIcon.$el.focus()
},
}
</script>
<template>
<div class="px-4 pt-3 pb-4 border-t border-gray-300">
<div class="text-xs uppercase font-bold text-gray-600 tracking-wide">
AUTEUR
</div>
<div class="flex items-center pt-2">
<img
src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Christine_Lagarde_(cropped).jpg"
class="object-cover w-10 h-10 rounded-full mr-3"
/>
<div>
<p class="font-bold text-gray-900">Christine Lagarde</p>
<p class="text-sm text-gray-700">À la BCE pour rien changer</p>
</div>
</div>
</div>
</template>
<script>
export default {}
</script>
<template>
<div class="border-t-2 mt-8 flex justify-between text-2xl font-semibold">
<nuxt-link v-if="prev" :to="prev.path" class="group prev-blog flex-1 py-8">
<fa icon="chevron-left" class="text-gray-300 mr-3 transition" />
<span class="group-hover:text-hover">
{{ prev.title }}
</span>
</nuxt-link>
<nuxt-link
v-if="next"
:to="next.path"
class="group next-blog flex-1 py-8 text-right"
>
<span class="group-hover:text-hover">
{{ next.title }}
</span>
<fa icon="chevron-right" class="text-gray-300 ml-3 transition" />
</nuxt-link>
</div>
</template>
<script>
export default {
name: 'AppNextPrev',
props: {
prev: {
type: Object,
default: null,
},
next: {
type: Object,
default: null,
},
},
}
</script>
<style lang="postcss" scoped>
.group.prev-blog:hover >>> .fa-chevron-left {
transform: translateX(-0.5em);
}
.group.next-blog:hover >>> .fa-chevron-right {
transform: translateX(0.5em);
}
</style>
<template>
<div class="p-4 bg-blue-100 dark:bg-blue-900 rounded">
<h1 class="font-bold mb-4">
{{ $t('faq.blockSubmitQuestionTitle') }}
</h1>
<t-button
class="mx-auto"
:text="$t('faq.blockSubmitQuestionButton')"
@click="$modal.show('FaqAskQuestionTModal')"
/>
<t-modal
:header="content.title"
name="FaqAskQuestionTModal"
variant="large"
@closed="loading = false"
>
<nuxt-content :document="content" />
<div slot="footer" class="flex">
<t-button
text="Demander"
:class="{ 'loading-state': loading }"
:disabled="loading"
@click="onAsk"
/>
<t-button
variant="text"
class="ml-4"
@click="$modal.hide('FaqAskQuestionTModal')"
>
{{ $t('cancel') }}
</t-button>
</div>
</t-modal>
</div>
</template>
<script>
export default {
name: 'FaqAskQuestionModal',
data() {
return {
content: {},
loading: false,
}
},
async fetch() {
this.content = await this.$content('ui/faq-ask-question-modal').fetch()
},
methods: {
onAsk() {
this.loading = true
},
},
}
// import {
// defineComponent,
// useContext,
// useAsync,
// ref,
// } from '@nuxtjs/composition-api'
// export default defineComponent({
// setup() {
// const { $content } = useContext()
// let content = ref({})
// content = useAsync(() => $content('ui/faq-ask-question-modal').fetch())
// return {
// content,
// }
// },
// })
</script>
<style lang="scss" scoped></style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment