|
1 | 1 | # My Life Timeline
|
2 | 2 |
|
3 |
| -A tool for visualizing life events on a timeline, available in Tcl/Tk (desktop) and JavaScript (web) versions. |
| 3 | +A Rust-based application for visualizing life events on a timeline, with both native and web versions using egui. |
4 | 4 |
|
5 | 5 | ## Features
|
6 | 6 |
|
7 |
| -- Display life periods on a timeline |
8 |
| -- Customize period names, start dates, and colors |
| 7 | +- Display life periods and yearly events on a timeline |
| 8 | +- Customize event names, start dates, and colors |
9 | 9 | - Support for YAML configuration
|
10 | 10 | - Dynamic updates based on configuration changes
|
| 11 | +- Cross-platform support (native and web) |
11 | 12 |
|
12 | 13 | ## Development Setup
|
13 | 14 |
|
14 |
| -This project uses `devenv` to manage dependencies. The following packages are included: |
| 15 | +This project uses `devenv` to manage dependencies and `trunk` for web builds. |
15 | 16 |
|
16 |
| -- `tcl`, `tk`, `tcllib` |
17 |
| -- `libyaml` |
18 |
| -- `gcc` |
19 |
| -- `raylib` (version `3.7.0`) |
20 |
| -- `cmake`, `pkg-config` |
21 |
| -- `python3` |
| 17 | +### Prerequisites |
22 | 18 |
|
23 |
| -### Setup Instructions |
24 |
| - |
25 |
| -1. Install [devenv](https://devenv.sh/). |
26 |
| -2. Run `devenv shell` to enter the development environment. |
| 19 | +- [Nix](https://nixos.org/download.html) with flakes enabled |
| 20 | +- [devenv](https://devenv.sh/) |
27 | 21 |
|
28 |
| -### Commands |
| 22 | +### Setup Instructions |
29 | 23 |
|
30 |
| -- `build-run-c`: Build and run the C version. |
31 |
| -- `run-tcl`: Run the Tcl version. |
32 |
| -- `serve-web`: Serve the web version (accessible at http://localhost:8000). |
| 24 | +1. Clone the repository: |
| 25 | +``` |
| 26 | +git clone https://github.com/waozixyz/mylife.git |
| 27 | +cd mylife |
| 28 | +``` |
| 29 | +2. Enter the development environment: |
| 30 | +``` |
| 31 | +devenv shell |
| 32 | +``` |
| 33 | +3. Build and run the project: |
| 34 | +- For native: |
| 35 | +``` |
| 36 | +cargo run |
| 37 | +``` |
| 38 | +- For web: |
| 39 | +``` |
| 40 | +trunk serve |
| 41 | +``` |
33 | 42 |
|
34 | 43 | ## Configuration Format
|
35 | 44 |
|
36 | 45 | ```yaml
|
37 | 46 | name: John Doe
|
38 |
| -date_of_birth: "2000-01" |
| 47 | +date_of_birth: 2000-01 |
| 48 | +life_expectancy: 80 |
39 | 49 | life_periods:
|
40 |
| - - name: Childhood |
41 |
| - start: "2000-01" |
42 |
| - color: "#FFB3BA" |
43 |
| - - name: Teenage Years |
44 |
| - start: "2013-01" |
45 |
| - color: "#BAFFC9" |
| 50 | +- name: Childhood |
| 51 | + start: 2000-01 |
| 52 | + color: "#FFB3BA" |
| 53 | +- name: Teenage Years |
| 54 | + start: 2013-01 |
| 55 | + color: "#BAFFC9" |
| 56 | +yearly_events: |
| 57 | +2022: |
| 58 | + - name: Winter Internship |
| 59 | + start: 2022-01-03 |
| 60 | + color: "#4CAF50" |
| 61 | + - name: Spring Semester |
| 62 | + start: 2022-03-21 |
| 63 | + color: "#2196F3" |
46 | 64 | ```
|
47 | 65 |
|
48 |
| -## Tcl/Tk Version |
| 66 | +## Native Version |
| 67 | +### Requirements |
| 68 | +All requirements are managed by devenv and specified in the devenv.nix file. |
| 69 | +
|
| 70 | +### Usage |
| 71 | +```cargo run``` |
49 | 72 |
|
| 73 | + |
| 74 | +## Web Version |
50 | 75 | ### Requirements
|
51 | 76 |
|
52 |
| -- Tcl/Tk |
53 |
| -- `yaml` package |
| 77 | +- Trunk (installed via devenv) |
| 78 | +- wasm32-unknown-unknown target (automatically added by devenv) |
54 | 79 |
|
55 | 80 | ### Usage
|
| 81 | +Start the development server: |
56 | 82 |
|
57 |
| -``` |
58 |
| -tclsh life.tcl [years] [yaml_file] |
59 |
| -``` |
| 83 | +```trunk serve``` |
60 | 84 |
|
61 |
| -- `years`: (Optional) Number of years to display (default: 100) |
62 |
| -- `yaml_file`: (Optional) Name of the YAML file in the `data` directory to load |
| 85 | +Open the provided URL in a web browser (usually http://127.0.0.1:8080) |
63 | 86 |
|
64 |
| -## JavaScript Version |
| 87 | +## Development |
| 88 | +### Adding Dependencies |
| 89 | +To add new dependencies, modify the Cargo.toml file and update the devenv.nix file if necessary. |
65 | 90 |
|
66 |
| -### Usage |
| 91 | +## Building for Release |
67 | 92 |
|
68 |
| -1. Open the HTML file in a web browser |
69 |
| -2. Modify the configuration using the form |
70 |
| -3. Load/Save configurations using the provided buttons |
| 93 | +- Native: |
| 94 | +```cargo build --release``` |
71 | 95 |
|
72 |
| -## Raylib Version |
73 |
| -### Usage |
74 |
| -This project uses raylib for graphical rendering. Ensure consistency by using the specified version in the devenv.nix file. |
| 96 | +- Web: |
| 97 | +```trunk build --release``` |
75 | 98 |
|
76 |
| -Use the command to provided in the devenv file to build and run the project. |
77 | 99 |
|
78 |
| -``` |
79 |
| -build-run-c |
80 |
| -``` |
| 100 | +## Contributing |
| 101 | +Contributions are welcome! Please feel free to submit a Pull Request. |
81 | 102 |
|
82 | 103 | ## License
|
83 |
| -
|
84 |
| -This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details. |
| 104 | +This project is licensed under the MIT License. See the LICENSE.md file for details. |
0 commit comments