twelve-of-code-official / library

The library for creating your own Twelve of Code challenges
0 stars 0 forks source link

Custom Challenge Packs #3

Open Mesure73L opened 9 months ago

Mesure73L commented 9 months ago

What problem were you having?

No response

What solution would you like?

Okay, so this isn't really a problem but I have an idea for Twelve of Code. Basically, in Settings (oh no not a mention of the settings tab) there could be like a "Manage Challenge Packs" with different challenge packs that you could use. (The Twelve of Code one will not be deletable).

But basically, you provide a URL to something like information.json but the JSON contents would be something more like as follows:

{
    "pack": {
        "title": "Custom Pack Example"
    },
    "categories": [
        {
            "title": "Example Category 1",
            "released": true,
            "challenges": [
                {
                    "title": "Example Challenge 1",
                    "url": "https://example.com/challenge/1-1.html",
                    "released": true
                },
                {
                    "title": "Example Challenge 2",
                    "url": "https://example.com/challenge/1-2.html",
                    "released": true
                },
                {
                    "title": "Example Challenge 3",
                    "url": "https://example.com/challenge/1-3.html",
                    "released": false
                }
            ]
        }
    ]
}

(Notes can be added with the same syntax for pack title, categories, or challenges.)


...and it would be displayed as something like this:

[!NOTE] This is a lazily made image. There is no code, and would have to be recreated.

image


[!CAUTION] There may have to be restrictions put in place to prevent hackers from controlling your Twelve of Code challenges, like maybe limited access to the CookieManager class, and possibly a caution warning when importing a challenge, as you're just running code.

This does not have to be accepted, it's just a cool idea I had to allow people to do even more coding challenges.

What alternatives have you considered?

No response

What are some pros and cons of doing this?

Pros:

Cons:

What page is this for?

Twelve of Code

BeepBot99 commented 9 months ago

Overall, this is a good idea, but I have a few thoughts/questions about it.

By the way, congratulations on issue twelve-of-code-official/library#3!

Mesure73L commented 9 months ago

There could be a cookie, packs, that stores the packs. It would be JSON that is an array (Yes, JSON can be an array instead of an object) that has links to the JSON files for all of the packs being used.

Yes, that's what I was thinking.

I don't like the UI that you made. I think it should be more like the resource pack selector in Minecraft Bedrock Edition.

It's a work in progress, the first thing I thought of lol.

As you mentioned, there could be potential security issues with having full read/write access to the CookieManager class. Therefore, I think that it should only be able to modify completition statuses for challenges in its pack.

Yes, that's what I was thinking. wait i already said that

Would there be different statuses for each challenge in each pack? For example, could you have completed 2025 January Challenge 2 in one pack but not in another? If so, the structure of the completed cookie would need to be changed.

Packs will have a seperate name and ID, forgot to add that to the example JSON, but kind of like Minecraft namespaces if you ever worked with that. (unique identifiers that define which challenge is which.)

What outreach would there be for other developers to make packs? How would other people find out about it?

Mainly just if people want to make it, I don't know.

Maybe packs could, in addition to being able to change the challenges, change the theme of the page too.

These are challenge packs, not resource packs. (There is a bug where adding styles to the challenge will change the whole CSS of the page, should probably be patched at some point.)

By the way, congratulations on issue twelve-of-code-official/library#3!

Thank you!

BeepBot99 commented 9 months ago

Is this fine with you?

What I make

BeepBot99 commented 9 months ago

Well, actually, now that I think about this more, I'm starting to doubt it. Why would a coding challenge have an option for someone else to make their own coding challenges? Why not just make their own website for them?

Mesure73L commented 9 months ago

Well, maybe they don’t want to set it up. Twelve of Code was a lot of work, and also some people might want to stick with one website.

Responding to your previous comment, I want a chance to try everything first (in a new branch ofc) but I’ll tell you if i need anything.

BeepBot99 commented 9 months ago

Okay, but I will still design a UI (In Figma, note actually code it unless you like it.) You can choose to keep or discard it, but I will still make it as a personal challenge.

Mesure73L commented 9 months ago

Ok

BeepBot99 commented 9 months ago

Idea for this:

You can create a custom information.json in a challenge pack

BeepBot99 commented 9 months ago

Also there could be a challenge "marketplace" and to add yours to it, all you do is you add a link to your manifest.json in a text file in the repository. You can create a pull request to do this, and your pack wil be reviewed before being added. You will also be able to just enter a link or upload a file to do a challenge. That is just an idea, you don't have to do it of course.