Skip to content

Commit

Permalink
fix(Docs): Fixes the docs so the properly render after the dependency…
Browse files Browse the repository at this point in the history
… update.
  • Loading branch information
alexanderson1993 committed Jul 12, 2022
1 parent eab1d31 commit 296db90
Show file tree
Hide file tree
Showing 19 changed files with 482 additions and 2,603 deletions.
8 changes: 1 addition & 7 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"flexlayout-react": "^0.7.3",
"flexsearch": "^0.7.21",
"gl-matrix": "^3.4.3",
"gray-matter": "^4.0.3",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"lottie-web": "^5.9.6",
Expand All @@ -54,19 +53,14 @@
"react-query": "^4.0.0-alpha.23",
"react-router-dom": "^6.3.0",
"reconnecting-websocket": "^4.4.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1",
"remark-frontmatter": "^4.0.1",
"remark-mdx-images": "^1.0.3",
"remark-prism": "^1.3.6",
"remark-rehype": "^10.1.0",
"rng": "^0.2.2",
"roman-numerals": "^0.3.2",
"three": "^0.142.0",
"three-stdlib": "^2.12.1",
"use-asset": "^1.0.4",
"valtio": "^1.6.1",
"vite-plugin-mdx": "^3.5.10",
"vite-plugin-markdown": "^2.0.2",
"vite-tsconfig-paths": "^3.5.0",
"zustand": "^3.7.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Card & Core Data
---

import DevLink from "../DevLink";

# Card & Core Creation

Cards and cores are the foundational UI elements for Thorium Nova. Cards are the
Expand Down Expand Up @@ -37,7 +35,7 @@ For more information and a reference about pubsub channels, see the
[Pubsub channel reference](pubsub-channel-reference) document.

> **IMPORTANT:** Make sure you properly export your data functions in your card
> from the "<DevLink>/client/src/cards/dataList.ts</DevLink>" file.
> from the "/client/src/cards/dataList.ts" file.
### Defining Card Requests

Expand Down Expand Up @@ -160,9 +158,9 @@ the following data sent:
That means the rest of the data needs to be collected with a subscription.

The data for each client is sent by the
"<DevLink>/server/src/systems/DataStreamSystem.ts</DevLink>" ECS system, which
also defines how often it is sent. On this interval, the data is processed and
encoded in a way that makes it easy to do
"/server/src/systems/DataStreamSystem.ts" ECS system, which also defines how
often it is sent. On this interval, the data is processed and encoded in a way
that makes it easy to do
[snapshot interpolation](https://github.com/geckosio/snapshot-interpolation#readme)
on the client.

Expand Down Expand Up @@ -223,7 +221,7 @@ Inputs are the way clients can trigger mutations to server data. Inputs are
messages sent from the client to the server over WebSockets to trigger events.
Since many cards may use the same input, and to make it easier to keep track of
all of the `pubsub.publish` calls, inputs are defined separately from cards. The
list of all inputs is kept in "<DevLink>/server/src/inputs/list.ts</DevLink>".
list of all inputs is kept in "/server/src/inputs/list.ts".

When a client needs to update server data, it sends a message to the server with
the name of the input and any appropriate parameters as a JavaScript object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
title: DataContext
---

import DevLink from "../DevLink";

# DataContext

To keep implementation details decoupled, the context for every data fetching
function and every server input is passed in as a parameter called
`DataContext`. This object represents data and methods associated with a
specific client that is making the request and should be available any time
there's data fetching happening. The DataContext is defined in
"<DevLink>/server/src/utils/DataContext.ts/</DevLink>".
"/server/src/utils/DataContext.ts/".

## `clientId`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: ECS Components
---

import DevLink from "../DevLink";

# ECS Components

ECS Components are the building blocks of entities. They define the data
Expand All @@ -12,7 +10,7 @@ structures can be assigned to entities to make them more than just an ID.
## Defining Components

Components should extend from the `Component` class defined in
"<DevLink>/server/src/components/utils.ts</DevLink>" and be placed inside the
"/server/src/components/utils.ts" and be placed inside the
`/server/src/components` folder or a sub-folder. Every component should includ a
static `id` which is a literal string type. Using `as const` here is helpful.

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: ECS Overview
---

import DevLink from "../DevLink";

# ECS Overview

[Entity Component System](https://en.wikipedia.org/wiki/Entity_component_system)
Expand Down Expand Up @@ -43,9 +41,8 @@ Since one system might depend on the results of another system's update, the
order that systems run matters.

Each flight has its own ECS world. When a flight is created, it will pull the
list of systems from "<DevLink>/server/src/systems/index.ts</DevLink>" and
instantiate them, and create any initial entities and assign them their
components.
list of systems from "/server/src/systems/index.ts" and instantiate them, and
create any initial entities and assign them their components.

> Note: Thorium Nova's ECS framework is currently only used on the server side,
> not the client side. This could change in the future, but for now it makes
Expand All @@ -61,5 +58,4 @@ Adding new data structures or simulations usually looks like this:
- Factory functions can be created for common entity types.
- [Create a new system](ecs-system) or change the test function or update
function of an existing system.
- Make sure any new systems are listed in
"<DevLink>/server/src/systems/index.ts</DevLink>"
- Make sure any new systems are listed in "/server/src/systems/index.ts"
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
title: ECS Systems
---

import DevLink from "../DevLink";

# ECS Systems

ECS Systems are what actually run the simulations and provide the behaviors to
the entity components. Systems are extended from the base `System` class and
exported from "<DevLink>/server/src/systems/index.ts</DevLink>" in the specific
order that they are supposed to run. The base `System` class is designed to keep
a cache of the entities associated with it so it doesn't have to iterate over
the entire entity list every time it runs.
exported from "/server/src/systems/index.ts" in the specific order that they are
supposed to run. The base `System` class is designed to keep a cache of the
entities associated with it so it doesn't have to iterate over the entire entity
list every time it runs.

The intention is to extend any of the several abstract methods provided by the
`System` class. These include `test`, `preUpdate`, `update`, `postUpdate`,
Expand Down Expand Up @@ -50,8 +48,7 @@ Called whenever an entity is removed from the system.

## Example

This code can be found in
"<DevLink>/server/src/systems/TimerSystem.ts</DevLink>"
This code can be found in "/server/src/systems/TimerSystem.ts"

```ts
import {Duration} from "luxon";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Inputs
---

import DevLink from "../DevLink";

# Inputs

Inputs define the messages that can be sent from any client to the server. The
Expand Down Expand Up @@ -64,18 +62,18 @@ export const clientInputs = {
```

Once the input is defined, it should be exported from the
"<DevLink>/server/src/inputs/list.ts</DevLink>" file. Exporting a `const` from
the input file makes it easier to use the `export {inputName} from 'filepath'`
syntax which keeps the list file uncluttered.
"/server/src/inputs/list.ts" file. Exporting a `const` from the input file makes
it easier to use the `export {inputName} from 'filepath'` syntax which keeps the
list file uncluttered.

## Sending Inputs using netSend

Thorium Nova provides the `netSend` function which can be imported from
"<DevLink>/client/src/context/netSend.tsx</DevLink>". This async function takes
an input name as the first parameter and the params object as the second
parameter. Conveniently, it's type checked and uses autocomplete based on the
input name you pass in. Being an async function, you can `await` the results to
get what the server sent back.
"/client/src/context/netSend.tsx". This async function takes an input name as
the first parameter and the params object as the second parameter. Conveniently,
it's type checked and uses autocomplete based on the input name you pass in.
Being an async function, you can `await` the results to get what the server sent
back.

```tsx
const ClientButton = () => {
Expand All @@ -102,11 +100,10 @@ const ClientButton = () => {

## Sending Inputs using HTTP POST

If you look at the source code for
"<DevLink>/client/src/context/netSend.tsx</DevLink>" you'll find that it's
mostly just a wrapper around an HTTP call to the `/netSend` endpoint. The
`netSend` implementation uses a multipart form upload for uploading files, but
the server also supports a JSON request body.
If you look at the source code for "/client/src/context/netSend.tsx" you'll find
that it's mostly just a wrapper around an HTTP call to the `/netSend` endpoint.
The `netSend` implementation uses a multipart form upload for uploading files,
but the server also supports a JSON request body.

It requires an `authorization` header which includes the client's name as the
`Bearer` token, as in `Authorization: Bearer my-client-name`. This is used to
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Demo Doc
order: 999
---

import Button from "../../components/ui/Button";

# Demo Doc

This is a doc to demonstrate different syntax and options available in the
Expand All @@ -25,16 +23,6 @@ order: 1
# Demo Doc
```

## MDX React Component Import

If your doc uses the `.mdx` extension, you can import React components from
elsewhere in the app and run it here. For example, here is a Thorium button:

<Button onClick={() => alert("Hi there!")}>Hi there!</Button>

> Note that you can't use fancy `@thorium/ui` paths here, since the MDX import
> doesn't recognize them. You have to use a full relative path to the component.
## Images

Images can be referenced using a relative path, like this:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 296db90

Please sign in to comment.