Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/templates from server #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Seboran
Copy link

@Seboran Seboran commented Oct 24, 2024

what does this PR do?

live templates loading from appwrite

you can test here: https://code-in-the-dark-editor-git-feat-templates-seborans-projects.vercel.app/compete

How does it work?

Set an appwrite collection with every attributes implementing TemplateInformations interface:

interface TemplateInformations {
  eventName: string;
  referenceImage: string;
  instructions: string;
  injectCode?: string;
  showPreview: boolean;
  demoMode: boolean;
}

Created fetchTemplates.ts which plugs to appwrite in server side.

Long pooling using SWR.

page previews are hosted in an appwrite bucket to keep them hidden.

I don't think we should move the other images and logos because we it makes relative URLs simpler

New env variables

You need to set 4 new environments variables:

APPWRITE_PROJECT_ID=""
APPWRITE_DATABASE_ID=""
APPWRITE_COLLECTION_ID=""
APPWRITE_READ_TOKEN=""

Some ideas and questions

  • long pooling with SWR works fine, but I wonder if won't make huge requests spikes...
    Thinking about this point, at the very worst we would have 8 participants long pooling every 2 seconds during 5 minutes, which would amount to 1200 requests, don't think it would make a huge impact
  • I refactored page.tsx to make it server side only because it looked cool, but now we're long pooling I wonder if it's useful
  • it's a bit cumbersome to change an entry
  • I don't think setting a timestamp is a good idea. we should manually change timings because we never know when a competition will start for real or if everybody is ready.
  • sorry for pnpm-lock.yml changes 🙈

Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
code-in-the-dark-editor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 6:44pm

@Seboran Seboran changed the title Feat/templates Feat/templates from server Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant