wilandwil 6a89bc303d Fixes/ server-correct pagination (#662)
Pagination of our frontend was implemented "naively" due to previous
time constraints; now, it's "correct" to reflect server responses
exactly. More precisely:
- the Pagination component (frontend) is updated to understand that
there are more fetch-able pages (backend) and it shows a "More ..."
button when the user have reached the last page on the frontend.
- this sub-feature of the Pagination module, the "More ..." button, is
implemented on the character sub-tab only (for now)
- the character sub-tab looks at the set of characters that it is
displaying (ie featured vs mine), and pass the correct fetch-more-pages
function to the Pagination component
- the underlying hooks to managed fetch feature objects and user
objects, their api invoker utilities, and the api classes are all
updated to deal with pagination properly

small issue:
- pagination of featured items uses "infinite pagination" to prevent
competitors from knowing how much data we have in our system, which
means, there will always be a "cursor to the next page", and we would
only know we have reached the end when we request a next page with a
cursor but a response of no results returns. so, for featured items,
when the user reached the last page, the "More ..." button will show up
once, if you clicked it and it goes away, there are no more items in the
server. This extra "More ..." button is the current "correct" behaviour.

---------

Co-authored-by: wil <wil@storyteller.ai>
2024-08-12 16:48:55 -04:00
2024-05-23 11:25:44 -04:00
2024-07-12 16:44:19 -04:00
2024-07-26 16:41:26 -04:00
2024-07-26 11:15:44 -04:00
2024-08-08 15:02:23 -04:00
2024-04-25 15:33:12 -04:00
2024-07-12 20:45:47 -04:00
2024-07-02 18:15:46 -04:00
2024-07-02 18:15:46 -04:00
2024-06-18 23:59:51 -04:00
2024-03-23 16:00:11 -04:00
2024-07-02 18:15:46 -04:00
2024-07-26 16:41:26 -04:00
2024-07-26 16:41:26 -04:00
2024-03-20 11:41:13 -04:00
2024-07-03 16:12:14 -04:00
2024-03-19 21:29:29 -04:00
2024-05-17 00:22:34 -07:00
2024-07-26 11:15:44 -04:00
2024-06-27 15:25:01 -04:00

Storyteller GGF

Coding Rules and Styles

Short Style Guide TS React and Engine:

No use of lets

No basic for loop operators.
Use the collection operators and array operators.

React Side / No modules over 200 lines. ( loose rule )

Don't do:
if (condition) return;

Do:
if (condition) {
	return;
}

No use of any type.
If you can use chat gpt to create the interface.

Branches

  • main - The main branch is the production source of truth.

    Changes to main will automatically build, but will not auto-deploy to production. You'll have to promote changes to production using the Netlify control panel.

    Merge your code to main frequently. If you have to have a long-lived set of changes, ask yourself whether it might be better to feature flag your code off and land it to main rather than fight rebasing against the whole team.

  • studio-staging - The staging auto-deploy branch.

    You do not ever need to interact with this branch. Changes to main will automatically be pushed to studio-staging and auto-deployed to https://studio-staging.studio.storyteller.ai . You can test changes that have landed in main here before promoting them to production.

  • studio-testing - The testing branch.

Anyone can push their changes to this branch for testing in a production-like environment. Since it is built and hosted on https://studio-testing.studio.storyteller.ai , you won't face CORS issues, same-site cookie issues, or have to use a local development proxy. (This doesn't obviate the need for a development proxy for fast development iteration, but is a fantastic way to test your changes in a "production-like" environment.)

Force push to this branch by using git push -f origin studio-testing

API Docs

Server API docs live here: https://storyteller-docs.netlify.app/

Local Testing & Development

Set up .env and the Proxy Server

Copy & paste the env settings from .env-local-proxy to .env, (if the file .env do not exist, simply create one at the root of this project's folder beside the other env settings files).

The settings from .env-local-proxy directs all requests to localhost:3000, this will relieve us from having to deal with CORS between various services.

Then, start the proxy server in the folder /proxy. Before running the proxy for the first time, run:

npm i

To start the proxy run:

npm run dev

If the proxy fails, make sure your node version is 18.18. If you need to change the node version run npm rebuild once before re-running npm run dev

Run the Code Locally

To setup and run this project's code locally:

npm install
npm run dev

PostHog

PostHog is installed and working. To create a feature flag go to https://us.posthog.com/project/75284/feature_flags Add the feature flag for all users.

To check the feature flag in the app use code similar to this

import { usePosthogFeatureFlag } from "~/hooks/usePosthogFeatureflag";
import { FeatureFlags } from "~/enums";

const Component = () => {
  const flag = usePosthogFeatureFlag(FeaturesFlags.FLAG_NAME);
  // if flag is true, the feature shoud be executed & showed;
  // if flag is false, the feature should be disabled & hid;
  // for example
  return(
    <>
      {flag && <ComponentThatDependsOnTheFlag />}
    </>
  );
};

Other Documentation

Here is the Swagger documentation for the backend endpoints

This project uses Remix for routing and Tailwind for styling:

On Netlify, we use functions:

Languages
Rust 59.4%
TypeScript 39.3%
JavaScript 0.7%
Python 0.2%
Shell 0.2%
Other 0.2%