Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/luovtyrell/officedadjokes-demo

Sprint 4 of the TypeScript and API module at the IT Academy
https://github.com/luovtyrell/officedadjokes-demo

Last synced: about 1 month ago
JSON representation

Sprint 4 of the TypeScript and API module at the IT Academy

Awesome Lists containing this project

README

        

# OfficeDadJokes-Demo

Project Screenshot

## Description

This project aims to create a web application that displays jokes to employees before they start their workday.

# Table of Contents

1. [OfficeDadJokes-Demo](#officedadjokes-demo)
2. [Description](#description)
3. [Key Features](#key-features)
4. [Technologies Used](#technologies-used)
5. [API Information](#api-information)
- [Jokes API 🀑](#jokes-api-)
- [Weather API β˜”οΈ](#weather-api-)
6. [Project Structure](#project-structure)
7. [Project Setup](#project-setup)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration Files](#configuration-files)
- [Babel Configuration (`babelrc`)](#babel-configuration-babelrc)
- [TypeScript Configuration (`tsconfig.json`)](#typescript-configuration-tsconfigjson)
- [Running Tests](#running-tests)
- [Compiling Sass](#compiling-sass)
8. [Layout Images](#layout-images)
9. [Author](#author)

## Key Features

- **Fetch Jokes from API**
- **Display random Jokes from two different APIs**
- **Joke Rating**
- **Weather Information**

## Technologies Used

![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white) ![Bootstrap](https://img.shields.io/badge/bootstrap-%238511FA.svg?style=for-the-badge&logo=bootstrap&logoColor=white) ![SASS](https://img.shields.io/badge/SASS-hotpink.svg?style=for-the-badge&logo=SASS&logoColor=white) ![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) ![Babel](https://img.shields.io/badge/Babel-F9DC3e?style=for-the-badge&logo=babel&logoColor=black)

## API Information

### Jokes API 🀑

- **Random Dad Joke**:

- URL: `https://icanhazdadjoke.com/`
- Header: `'Accept': 'application/json'`

- **Chuck Norris Jokes**:
- URL: `https://api.chucknorris.io/jokes/random`
- Header: `'Accept': 'application/json'`

### Weather API β˜”οΈ

- **Weather API**:
- URL: `https://www.weatherapi.com/`
- API Key required.

### Project Structure

```
OfficeDadJokes-Demo/
β”œβ”€β”€ dist/ -> copilation files will appear (TS to JS)
β”œβ”€β”€ node_modules/ -> this will appear when you install it
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ APIs/
β”‚ β”‚ β”œβ”€β”€ jokeFeatures.ts
β”‚ β”‚ └── weatherFeatures.ts
β”‚ β”œβ”€β”€ IMG/
β”‚ β”‚ β”œβ”€β”€ layout samples/
β”‚ β”‚ β”œβ”€β”€ SVG/
β”‚ β”‚ └── background2.png
β”‚ β”œβ”€β”€ interfaces/
β”‚ β”‚ └── APIsInterfaces.ts
β”‚ β”œβ”€β”€ styles/
β”‚ β”‚ β”œβ”€β”€ style.css -> copilation scss to css
β”‚ β”‚ └── style.scss
β”‚ β”œβ”€β”€ main.ts
β”‚ └── test/
β”‚ └── getFunctions.test.ts
β”œβ”€β”€ .babelrc
β”œβ”€β”€ .gitignore
β”œβ”€β”€ index.html
β”œβ”€β”€ package.json
β”œβ”€β”€ test-results.html -> this will appear when you run tests
└── tsconfig.json
```

## Project Setup

### Prerequisites

- Node.js
- npm (Node Package Manager)

### Installation

1. Clone the repository:

```bash
git clone https://github.com/Luovtyrell/OfficeDadJokes-Demo.git
cd OfficeDadJokes-Demo
```

2. Install dependencies:

```bash
npm install typescript
npm install bootstrap
npm install jest
npm install sass
```

### Configuration Files

#### Babel Configuration (`.babelrc`)

```json
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
}
```

#### TypeScript Configuration (`tsconfig.json`)

```json
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"target": "es2016",
"module": "ESNext",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts"]
}
```

### Running Tests

The project uses Jest for testing. To run tests, use the following command and see the results in your console or `test-results.html`

```bash
npm jest
```

### Compiling Sass

To compile Sass files into CSS, use the following command, then don't forget in `index.html` use your compiled css. For this I used the `watch sass` extension for VSC.

## Layout images

Version 1

![version 1](./src/IMG/layout%20samples/version%201/mobileLayoutVersion1.png)
![version 1](./src/IMG/layout%20samples/version%201/tabletLayoutVersion1.png)
![version 1](./src/IMG/layout%20samples/version%201/webLayoutVersion1.png)

Version 2

![version 2](./src/IMG/layout%20samples/version%202/mobileLayoutVersion2.png)
![version 2](./src/IMG/layout%20samples/version%202/tabletLayoutVersion2.png)
![version 2](./src/IMG/layout%20samples/version%202/webLayoutVersion2.png)

Version 3

![version 3](./src/IMG/layout%20samples/version%203/mobileLayoutVersion3.png)
![version 3](./src/IMG/layout%20samples/version%203/tabletLayoutVersion3.png)
![version 3](./src/IMG/layout%20samples/version%203/webLayputVersion3.png)

Version 4

![version 4](./src/IMG/layout%20samples/version%204/mobileLayoutVersion4.png)
![version 4](./src/IMG/layout%20samples/version%204/tabletLayoutVersion4.png)
![version 4](./src/IMG/layout%20samples/version%204/webLayoutVersion4.png)

Final version

![final](./src/IMG/layout%20samples/final%20version/mobileLayout.png)
![final](./src/IMG/layout%20samples/final%20version/tabletLayout.png)
![final](./src/IMG/layout%20samples/final%20version/webLayout.png)

## Author

- LucΓ­a MΒͺ OrdoΓ±ez Vilanova - _React, It Academy_. [@Luovtyrell](https://www.github.com/Luovtyrell)