Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tech-andgar/ionic-angular-todo-app
๐ App created using the Ionic framework, using a firebase cloud database to store to-do data. All CRUD operations can be carried out using the Ionic UI.
https://github.com/tech-andgar/ionic-angular-todo-app
angular ionic ionic-framework todo
Last synced: 25 days ago
JSON representation
๐ App created using the Ionic framework, using a firebase cloud database to store to-do data. All CRUD operations can be carried out using the Ionic UI.
- Host: GitHub
- URL: https://github.com/tech-andgar/ionic-angular-todo-app
- Owner: tech-andgar
- Created: 2024-09-07T22:40:20.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-09T04:47:38.000Z (5 months ago)
- Last Synced: 2025-01-10T05:16:41.411Z (about 1 month ago)
- Topics: angular, ionic, ionic-framework, todo
- Language: TypeScript
- Homepage:
- Size: 32.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# # :zap: Ionic Todo App
## Overview
This project is a Todo App developed with Ionic, TypeScript, and Angular. It features a robust interface for managing todo items, including creating, reading, updating, and deleting them, as well as performing batch operations and managing resources. The app uses a Firebase cloud database for data storage and the [Ionic framework](https://ionicframework.com/docs) for its UI. The API is designed to be flexible and consistent, supporting various implementations while maintaining a unified interface.
- All CRUD operations can be performed through the Ionic UI.
- **Note:** To open web links in a new window, use _ctrl+click_ on the link.![GitHub repo size](https://img.shields.io/github/repo-size/tech-andgar/ionic-angular-todo-app?style=plastic)
![GitHub pull requests](https://img.shields.io/github/issues-pr/tech-andgar/ionic-angular-todo-app?style=plastic)
![GitHub Repo stars](https://img.shields.io/github/stars/tech-andgar/ionic-angular-todo-app?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/tech-andgar/ionic-angular-todo-app?style=plastic)## :page_facing_up: Table of contents
- [# :zap: Ionic Todo App](#-zap-ionic-todo-app)
- [Overview](#overview)
- [:page\_facing\_up: Table of contents](#page_facing_up-table-of-contents)
- [:cool: Features](#cool-features)
- [๐ฆ Installation Offline](#-installation-offline)
- [:camera: Screenshots](#camera-screenshots)
- [:signal\_strength: Technologies](#signal_strength-technologies)
- [๐ณ Project Structure](#-project-structure)
- [:floppy\_disk: Setup / Installation](#floppy_disk-setup--installation)
- [Usage](#usage)
- [Key Components](#key-components)
- [๐ API Reference](#-api-reference)
- [TodosApi](#todosapi)
- [Todo Retrieval Methods](#todo-retrieval-methods)
- [Todo Modification Methods](#todo-modification-methods)
- [Todo Deletion Methods](#todo-deletion-methods)
- [Batch Operations Methods](#batch-operations-methods)
- [Resource Management Methods](#resource-management-methods)
- [:computer: Code Examples - Implementation Details](#computer-code-examples---implementation-details)
- [LocalStorageTodosApi](#localstoragetodosapi)
- [๐งช Testing](#-testing)
- [โ ๏ธ Performance Considerations](#๏ธ-performance-considerations)
- [:clipboard: Status \& To-do list](#clipboard-status--to-do-list)
- [Contributing](#contributing)
- [:file\_folder: License](#file_folder-license)
- [:envelope: Contact](#envelope-contact)## :cool: Features
**CRUD operations:**
- Create: Click '+' to create a to-do item.
- Read: Line items are displayed on the home page.
- Update: Click on item line to edit.
- Delete: swipe left and a colored 'DONE' button appears on the right.
- Batch operations (clear completed, complete all)
- Observable-based API for reactive programming
- Local storage persistence
- TypeScript for type safety
- Abstract API design for flexibility in implementation## ๐ฆ Installation Offline
- [ANDROID APK (UNSIGNED)](./docs/installer/android/)
- [IOS IPA (UNSIGNED)](./docs/installer/ios/)
## :camera: Screenshots
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-multilanguage.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-web.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-category.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-filter-category.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-slide.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-options.png)
![todo items shown on ionic frontend and Firestore database](./docs/imgs/todo-app-undo.png)
![todo](./docs/video/todo-app.mp4)## :signal_strength: Technologies
- [Ionic/angular v8](https://ionicframework.com/)
- [Ionic v8](https://ionicframework.com/)
- [Angular v18](https://angular.io/)
- [Firebase cloudstore v10](https://firebase.google.com/)## ๐ณ Project Structure
```
todo/
โโโ src
โย ย โโโ app
โย ย โย ย โโโ app.component.html
โย ย โย ย โโโ app.component.scss
โย ย โย ย โโโ app.component.spec.ts
โย ย โย ย โโโ app.component.ts
โย ย โย ย โโโ app.routes.ts
โย ย โย ย โโโ core
โย ย โย ย โย ย โโโ domain
โย ย โย ย โย ย โย ย โโโ api
โย ย โย ย โย ย โย ย โย ย โโโ todos_api.ts
โย ย โย ย โย ย โย ย โโโ exceptions
โย ย โย ย โย ย โย ย โย ย โโโ exceptions.ts
โย ย โย ย โย ย โย ย โโโ model
โย ย โย ย โย ย โย ย โโโ category.model.ts
โย ย โย ย โย ย โย ย โโโ json_map.ts
โย ย โย ย โย ย โย ย โโโ todo.model.ts
โย ย โย ย โย ย โโโ language
โย ย โย ย โย ย โย ย โโโ language-switcher.component.ts
โย ย โย ย โย ย โย ย โโโ language.service.ts
โย ย โย ย โย ย โย ย โโโ model
โย ย โย ย โย ย โย ย โโโ language.model.ts
โย ย โย ย โย ย โโโ settings
โย ย โย ย โย ย โย ย โโโ settings-dropdown.component.ts
โย ย โย ย โย ย โโโ theme
โย ย โย ย โย ย โโโ theme-switcher.component.ts
โย ย โย ย โย ย โโโ theme.service.ts
โย ย โย ย โโโ features
โย ย โย ย โโโ categories
โย ย โย ย โย ย โโโ data
โย ย โย ย โย ย โย ย โโโ infrastructure
โย ย โย ย โย ย โย ย โย ย โโโ local-storage-api
โย ย โย ย โย ย โย ย โย ย โโโ local.storage.categories.api.ts
โย ย โย ย โย ย โย ย โโโ repository
โย ย โย ย โย ย โย ย โโโ categories-repository-impl.ts
โย ย โย ย โย ย โโโ domain
โย ย โย ย โย ย โย ย โโโ infrastructure
โย ย โย ย โย ย โย ย โย ย โโโ categories_api.ts
โย ย โย ย โย ย โย ย โโโ repository
โย ย โย ย โย ย โย ย โโโ categories_repository.ts
โย ย โย ย โย ย โโโ presentation
โย ย โย ย โย ย โโโ category-list
โย ย โย ย โย ย โโโ category-list.page.ts
โย ย โย ย โย ย โโโ category-list.service.ts
โย ย โย ย โโโ home
โย ย โย ย โย ย โโโ presentation
โย ย โย ย โย ย โโโ home.page.ts
โย ย โย ย โโโ todos
โย ย โย ย โโโ data
โย ย โย ย โย ย โโโ infrastructure
โย ย โย ย โย ย โย ย โโโ local_storage
โย ย โย ย โย ย โย ย โโโ local.storage.todos.api.ts
โย ย โย ย โย ย โโโ repository
โย ย โย ย โย ย โโโ todos-repository-impl.ts
โย ย โย ย โโโ domain
โย ย โย ย โย ย โโโ repository
โย ย โย ย โย ย โโโ todos_repository.ts
โย ย โย ย โโโ presentation
โย ย โย ย โโโ components
โย ย โย ย โย ย โโโ category-badge.component.ts
โย ย โย ย โย ย โโโ category-filter.component.ts
โย ย โย ย โย ย โโโ stats
โย ย โย ย โย ย โย ย โโโ stats.component.ts
โย ย โย ย โย ย โย ย โโโ stats.service.ts
โย ย โย ย โย ย โโโ todo-list-item
โย ย โย ย โย ย โย ย โโโ todo-list-item.component.ts
โย ย โย ย โย ย โย ย โโโ todo-list-item.service.ts
โย ย โย ย โย ย โโโ todos-overview-filter-button.component.ts
โย ย โย ย โย ย โโโ todos-overview-options-button.component.ts
โย ย โย ย โโโ edit-todo
โย ย โย ย โย ย โโโ edit-todo.page.ts
โย ย โย ย โย ย โโโ edit-todo.service.ts
โย ย โย ย โโโ todos-overview
โย ย โย ย โโโ todos-overview.page.ts
โย ย โย ย โโโ todos-overview.service.ts
โย ย โโโ app.config.ts
โย ย โโโ assets
โย ย โย ย โโโ i18n
โย ย โย ย โย ย โโโ en.json
โย ย โย ย โย ย โโโ es.json
โย ย โย ย โโโ icon
โย ย โย ย โย ย โโโ favicon.png
โย ย โย ย โโโ shapes.svg
โย ย โโโ environments
โย ย โย ย โโโ environment.prod.ts
โย ย โย ย โโโ environment.ts
โย ย โโโ global.scss
โย ย โโโ index.html
โย ย โโโ main.ts
โย ย โโโ polyfills.ts
โย ย โโโ test.ts
โย ย โโโ theme
โย ย โย ย โโโ variables.scss
โย ย โโโ zone-flags.ts
โโโ tsconfig.app.json
โโโ tsconfig.json
โโโ tsconfig.spec.json
```- `todo.model.ts`: Defines the `Todo` interface
- `todos.api.ts`: Contains the abstract `TodosApi` class
- `local-storage-todos.api.ts`: Implements `TodosApi` using local storage## :floppy_disk: Setup / Installation
1. Clone the repository:
```shell
git clone https://github.com/tech-andgar/todo-api-project.git
```2. Navigate to the project directory:
```shell
cd todo-api-project
```3. Install dependencies:
```shell
pnpm i
```or
```shell
yarn i
```or
```shell
npm i
```4. Add firebase access credentials in:
`environment.ts`
5. Run the development server on _localhost://8100_:
``` shell
ionic serve
```6. Create build artifacts in `www` folder:
``` shell
npm run build
```## Usage
To use the Todo API in your Angular application, inject the `TodosApi` service into your component or service:
```typescript
import { Component } from '@angular/core';
import { TodosApi } from './path-to-todos-api';
import { Todo } from './path-to-todo-model';@Component({
selector: 'app-todo-list',
template: '...'
})
export class TodoListComponent {
todos: Todo[] = [];constructor(private todosApi: TodosApi) {
this.todosApi.getTodos().subscribe(todos => this.todos = todos);
}addTodo(todo: Todo) {
this.todosApi.saveTodo(todo).subscribe(success => {
if (success) {
console.log('Todo added successfully');
}
});
}
}
```## Key Components
1. `core/domain/model/todo.model.ts`: Defines the `Todo` interface.
2. `core/api/todos.api.ts`: Abstract class defining the API for managing todos.
3. `data/api/local-storage-todos.api.ts`: Concrete implementation of `TodosApi` using local storage.
4. `features/todo/`: Contains components, services, and module for the todo feature.## ๐ API Reference
### TodosApi
The `TodosApi` abstract class provides the following methods:
#### Todo Retrieval Methods
- `getTodos(): Observable`
- Provides an Observable of all todos.- `getTodo(todoId: string): Observable`
- Retrieves a todo by its ID.#### Todo Modification Methods
- `saveTodo(todo: Todo): Observable`
- Saves a todo. If a todo with the same ID already exists, it will be replaced.- `saveTodoAt(todo: Todo, index: number | null): Observable`
- Saves a todo at a specified index. If a todo with the same ID already exists, it will be replaced.#### Todo Deletion Methods
- `deleteTodo(id: string): Observable`
- Deletes the todo with the given ID.#### Batch Operations Methods
- `clearCompleted(): Observable`
- Deletes all completed todos.- `completeAll(isCompleted: boolean): Observable`
- Sets the `isCompleted` state of all todos to the given value.#### Resource Management Methods
- `close(): Observable`
- Closes the API client and frees up any resources.## :computer: Code Examples - Implementation Details
### LocalStorageTodosApi
The `LocalStorageTodosApi` class implements the `TodosApi` abstract class using browser's local storage for persistence. Key features include:
- Uses `BehaviorSubject` to manage the stream of todos
- Implements all abstract methods from `TodosApi`
- Persists todos to local storage after each operation
- Retrieves todos from local storage on initializationExample of saving a todo:
```typescript
saveTodo(todo: Todo): Observable {
const todos = [...this.todoStreamController.value];
const todoIndex = todos.findIndex(t => t.id === todo.id);
if (todoIndex >= 0) {
todos[todoIndex] = todo;
} else {
todos.push(todo);
}this.todoStreamController.next(todos);
localStorage.setItem(LocalStorageTodosApi.kTodosCollectionKey, JSON.stringify(todos));return this.getTodo(todo.id).pipe(map(todo => !!todo));
}
```## ๐งช Testing
To run the tests for this project:
```shell
ng test
```We use Jasmine for unit testing and Karma as the test runner. Key areas to test include:
- Individual CRUD operations
- Batch operations
- Edge cases (e.g., deleting non-existent todos)
- Local storage persistence## โ ๏ธ Performance Considerations
- The current implementation loads all todos into memory, which may not be optimal for large datasets.
- Consider implementing pagination or virtual scrolling for better performance with large lists.
- Local storage has limited capacity; for larger applications, consider using IndexedDB or a backend server.## :clipboard: Status & To-do list
- Status: Working.
- To-do:
- [ ] Implementation Firestore
- [ ] Implementation Feature Flag
- [ ] Testing## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request## :file_folder: License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
## :envelope: Contact
Repo created by [TECH-ANDGAR](https://github.com/tech-andgar), email: