Skip to content
Snippets Groups Projects
Commit eedf24c7 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore: cleanup

parent 75bb0f78
Branches
Tags
No related merge requests found
...@@ -9,86 +9,10 @@ ...@@ -9,86 +9,10 @@
```sh ```sh
docker run -ti --rm -p 8080:8080 -p 5984:5984 -p 8025:8025 -e COZY_DISABLE_CSP=1 -v $(pwd)/lets-gone/build:/data/cozy-app/lets-gone -v ~/cozy.yaml:/etc/cozy/cozy.yaml cozy/cozy-app-dev docker run -ti --rm -p 8080:8080 -p 5984:5984 -p 8025:8025 -e COZY_DISABLE_CSP=1 -v $(pwd)/lets-gone/build:/data/cozy-app/lets-gone -v ~/cozy.yaml:/etc/cozy/cozy.yaml cozy/cozy-app-dev
cd lets-gone
yarn start yarn start
``` ```
Then run the mock server
```sh
node server/server.js
```
## Hack
_:pushpin: Note:_ we recommend to use [Yarn] instead of NPM for package management. Don't hesitate to [install][yarn-install] and use it for your Cozy projects, it's now our main node packages tool for Cozy official apps.
### Install
Hacking the Cozy Lets gone app requires you to [setup a dev environment][setup].
You can then clone the app repository and install dependencies:
```sh
$ git clone https://github.com/bastiendmt/lets-gone.git
$ cd lets-gone
$ yarn install
```
:pushpin: If you use a node environment wrapper like [nvm] or [ndenv], don't forget to set your local node version before doing a `yarn install`.
Cozy's apps use a standard set of _npm scripts_ to run common tasks, like watch, lint, test, build…
### Run it inside a Cozy using Docker
You can run your application inside a Cozy thanks to the [cozy-stack docker image][cozy-stack-docker]:
```sh
# in a terminal, run your app in watch mode with a docker running Cozy
$ cd lets-gone
$ yarn start
```
```sh
# in an other terminal, run the docker image
$ cd lets-gone
$ yarn stack:docker:dev
```
After the build and the docker image launched, your app is now available at http://lets-gone.cozy.tools:8080.
Note: By default, HMR (Hot Module Replacement) is enabled on your front application. To have it working, we have disabled our CSP (Content Security Policy) when running `yarn stack:docker:dev`. This is not the configuration we'll have in a production environnement. To test our app in real conditions, build your application by running `yarn build` and launch the docker image with the `yarn stack:docker:prod` command.
### Living on the edge
[Cozy-ui] is our frontend stack library that provides common styles and components accross the whole Cozy's apps. You can use it for you own application to follow the official Cozy's guidelines and styles. If you need to develop / hack cozy-ui, it's sometimes more useful to develop on it through another app. You can do it by cloning cozy-ui locally and link it to yarn local index:
```sh
git clone https://github.com/cozy/cozy-ui.git
cd cozy-ui
yarn install
yarn link
```
then go back to your app project and replace the distributed cozy-ui module with the linked one:
```sh
cd cozy-drive
yarn link cozy-ui
```
[Cozy-client-js] is our API library that provides an unified API on top of the cozy-stack. If you need to develop / hack cozy-client-js in parallel of your application, you can use the same trick that we used with [cozy-ui]: yarn linking.
### Tests
Tests are run by [jest] under the hood. You can easily run the tests suite with:
```sh
$ cd lets-gone
$ yarn test
```
:pushpin: Don't forget to update / create new tests when you contribute to code to keep the app the consistent.
## Models ## Models
The Cozy datastore stores documents, which can be seen as JSON objects. A `doctype` is simply a declaration of the fields in a given JSON object, to store similar objects in an homogeneous fashion. The Cozy datastore stores documents, which can be seen as JSON objects. A `doctype` is simply a declaration of the fields in a given JSON object, to store similar objects in an homogeneous fashion.
...@@ -117,27 +41,6 @@ If you want to work on Lets gone and submit code modifications, feel free to ope ...@@ -117,27 +41,6 @@ If you want to work on Lets gone and submit code modifications, feel free to ope
[Cozy] is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you. [Cozy] is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.
### Localization
Localization and translations are handled by [Transifex][tx], which is used by all Cozy's apps.
As a _translator_, you can login to [Transifex][tx-signin] (using your Github account) and claim an access to the [app repository][tx-app]. Transifex will then create pull request on the repository, and the locales are merged after validating the pull request.
As a _developer_, you have to modify json in `/src/locales`. New locales will be automatically added to Transifex. If you need to pull or push manually locales, you can use [Transifex CLI](tx-cli). If you were using a [transifex-client](tx-client), you must move to [Transifex CLI](tx-cli) to be compatible with the v3 API.
### Maintainer
The lead maintainer for Lets gone is [bastiendmt](https://github.com/bastiendmt), send him/her a :beers: to say hello!
### Get in touch
You can reach the Cozy Community by:
- Chatting with us on IRC `#cozycloud` on [Libera.Chat][libera]
- Posting on our [Forum][forum]
- Posting issues on the [Github repos][github]
- Say Hi! on [Twitter][twitter]
## License ## License
Lets gone is developed by bastiendmt and distributed under the [AGPL v3 license][agpl-3.0]. Lets gone is developed by bastiendmt and distributed under the [AGPL v3 license][agpl-3.0].
......
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2"
}
}
/* eslint-disable no-console */
const express = require('express')
const fs = require('fs')
const path = require('path')
const cors = require('cors')
const { Client } = require('@notionhq/client')
require('dotenv').config()
const app = express()
const port = 3000
app.use(cors())
// Middleware to parse JSON bodies
app.use(express.json())
const notion = new Client({
auth: process.env.NOTION_SECRET
})
const databaseId = '6e4ba538f94545e3b60f428632fc1cfc'
// Route to serve the JSON file
app.get('/actions', (req, res) => {
notion.databases
.query({ database_id: databaseId })
.then(response => {
console.log(response)
return res.json(response)
})
.catch(error => {
console.error('Error retrieving database:', error)
res.status(500).json({ error: 'Error retrieving data from Notion' })
})
})
app.get('/alimentation', (req, res) => {
notion.databases
.query({
database_id: databaseId,
filter: {
property: 'Domaine',
select: {
equals: 'Alimentation'
}
}
})
.then(response => {
console.log(response)
return res.json(response)
})
.catch(error => {
console.error('Error retrieving database:', error)
res.status(500).json({ error: 'Error retrieving data from Notion' })
})
})
// Start the server
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`)
})
This diff is collapsed.
...@@ -4,9 +4,9 @@ import React, { useEffect, useState } from 'react' ...@@ -4,9 +4,9 @@ import React, { useEffect, useState } from 'react'
import { Link, useParams } from 'react-router-dom' import { Link, useParams } from 'react-router-dom'
import { ActionsService } from 'services/actions.service' import { ActionsService } from 'services/actions.service'
import { AnswersService } from 'services/answers.service' import { AnswersService } from 'services/answers.service'
import { Action, AxesKey, BaseAction } from 'types/actions.type' import { Action, AxesKey } from 'types/actions.type'
import './SingleAxe.scss'
import { groupByDomaine } from 'utils/utils' import { groupByDomaine } from 'utils/utils'
import './SingleAxe.scss'
/** /**
* List all the domains of an axe * List all the domains of an axe
......
export type NotionResponse = {
object: string
results: Array<NotionEntries>
next_cursor: string
has_more: boolean
type: string
page_or_database: {}
request_id: string
}
export type NotionEntries = {
object: string
id: string
created_time: string
last_edited_time: string
created_by: {
object: string
id: string
}
last_edited_by: {
object: string
id: string
}
cover: any
icon: any
parent: {
type: string
database_id: string
}
archived: boolean
in_trash: boolean
properties: {
Axe: {
id: string
type: string
select: {
id: string
name: string
color: string
}
}
'Réponses possibles': {
id: string
type: string
select: {
id: string
name: string
color: string
}
}
Objectifs: {
id: string
type: string
select: {
id: string
name: string
color: string
}
}
ID: {
id: string
type: string
unique_id: {
prefix: string
number: number
}
}
Domaine: {
id: string
type: string
select: {
id: string
name: string
color: string
}
}
Action: {
id: string
type: string
title: Array<{
type: string
text: {
content: string
link: any
}
annotations: {
bold: boolean
italic: boolean
strikethrough: boolean
underline: boolean
code: boolean
color: string
}
plain_text: string
href: any
}>
}
}
url: string
public_url: string
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment