{{/*
    This is a copy-paste from base.html because we want to preserve the unique
    style of this page no matter what future changes we make to the base.
*/}}
<!DOCTYPE html{{ if .OpenGraphItems }} prefix="og: http://ogp.me/ns#"{{ end }}>
<html lang="en-US">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" type="image/png" sizes="16x16" href="{{ static "favicon-16x16.png" }}">
    <link rel="icon" type="image/png" sizes="32x32" href="{{ static "favicon-32x32.png" }}">

    {{ if .CanonicalLink }}<link rel="canonical" href="{{ .CanonicalLink }}">{{ end }}
    {{ range .OpenGraphItems }}
        {{ if .Property }}
            <meta property="{{ .Property }}" content="{{ .Value }}" />
        {{ else }}
            <meta name="{{ .Name }}" content="{{ .Value }}" />
        {{ end }}
    {{ end }}
    {{ if .Title }}
        <title>{{ .Title }} | Handmade Network</title>
    {{ else }}
        <title>Handmade Network</title>
    {{ end }}

    <script src="{{ static "js/templates.js" }}"></script>
    <script src="{{ static "js/showcase.js" }}"></script>

    <link rel="stylesheet" href="{{ static "fonts/mohave/stylesheet.css" }}">
    <link href='https://fonts.googleapis.com/css?family=Fira+Sans:300,400,500,600' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Fira+Mono:300,400,500,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="{{ static "style.css" }}">

    <style>
        :root {
            --content-background: #f8f8f8;
        }

        body {
            background: linear-gradient(#ab4c47, #a5467d);
        }

        .user-options,
        header form,
        header .menu-bar .wiki,
        header .menu-bar .library
        {
            display: none !important;
        }

        header {
            border-bottom-color: white;
            margin-bottom: 0 !important;
        }

        .hmn-logo {
            background-color: rgba(255, 255, 255, 0.1) !important;
        }

        header a, footer a {
            color: white !important;
        }

        header .submenu {
            background-color: #ab4c47;
        }

        #top-container {
            margin: 3rem 0;
        }

        #logo {
            width: 16rem;
        }

        h1, h2, h3 {
            font-family: 'MohaveHMN', sans-serif;
            margin-bottom: 0;
            font-weight: normal;
        }

        #title {
            color: white;
            font-size: 2.4rem;
            line-height: 0.8;
            margin-top: 2rem;
            letter-spacing: -0.06rem;
            text-transform: uppercase;
        }

        #dates {
            font-variant: small-caps;
            font-size: 1.6rem;
            margin-top: 0.2rem;
        }

        #tagline {
            font-size: 1rem;
            margin-top: 1rem;
            line-height: 1.4;
        }

        #top-container a {
            color: white !important;
            text-decoration: underline;
        }

        #actions {
            margin-top: 1.5rem;
        }

        #actions a {
            text-decoration: none;
            line-height: 1.4;
            font-weight: 500;

            transition: background-color 50ms ease-in-out;
            background-color:rgba(255, 255, 255, 0.1);
        }

        #actions a:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        #actions a:active {
            background-color: rgba(255, 255, 255, 0.15);
        }

        .section {
            font-size: 1rem;
            line-height: 1.4;
        }

        .section h2 {
            font-variant: small-caps;
            font-size: 2.2rem;
            line-height: 1.1;
        }

        .section h3 {
            font-variant: small-caps;
            font-size: 2rem;
            line-height: 0.8;
            margin-top: 1.4rem;
        }

        .section p {
            margin-top: 1em;
            margin-bottom: 1em;
        }

        .section a {
            text-decoration: underline;
        }

        .flex-fair {
            flex-basis: 1px;
            flex-grow: 1;
            flex-shrink: 1;
        }

        ul {
            list-style-type: disc;
        }

        li {
            margin-top: 0.6rem;
            margin-bottom: 0.6rem;
        }

        .section li p {
            margin-top: 0.6rem;
            margin-bottom: 0.6rem;
        }

        footer {
            border-top: 2px solid white;
            margin-top: 2rem;
            text-align: center;
        }

        footer h2 {
            text-transform: uppercase;
        }

        .showcase-item {
            background-color: rgba(0, 0, 0, 0.2);
            border-color: rgba(255, 255, 255, 0.5);
        }

        @media screen and (min-width: 30em) {
            /* not small styles */

            #top-container {
                margin: 5.4rem 0;
            }

            #logo {
                width: 31rem;
            }

            #title {
                font-size: 5.2rem;
                margin-top: 4rem;
            }

            #dates {
                font-size: 2.8rem;
            }

            #tagline {
                font-size: 1.2rem;
                margin-top: 1.2rem;
            }

            #actions {
                margin-top: 2.2rem;
            }

            #actions a {
                font-size: 1.2rem;
            }

            .section h2 {
                font-size: 3.4rem;
            }

            .section h3 {
                font-size: 2.4rem;
                margin-top: 1.6rem;
            }
        }
    </style>
</head>

<body>
    <div class="left white">
        <div class="mt4-ns mw8 margin-center ph3-m ph4-l">
            {{ template "header.html" . }}
        </div>

        <div id="top-container" class="flex flex-column items-center ph3">
            <img id="logo" src="{{ static "wheeljam2021/logo.svg" }}">
            <h1 id="title">Wheel Reinvention Jam</h1>
            <h2 id="dates">September 27 - October 3, 2O21</h2>
            <div id="tagline" class="center">
                A one-week jam to bring a fresh perspective to old ideas.
            </div>
            <div id="actions" class="flex justify-center">
                <a class="ba b--white br2 pv2 pv3-ns ph3 ph4-ns" target="_blank" href="https://handmade.network/forums/jam">See the submissions</a>
                <a class="ba b--white br2 pv2 pv3-ns ph3 ph4-ns ml3" target="_blank" href="https://discord.gg/hmn">Join the Discord</a>
            </div>
        </div>

        <div class="section mw8 margin-center ph3 ph4-l mv4">
            <p>
                The <strong>Wheel Reinvention Jam</strong> is a one-week-long jam where you create a replacement for a program that frustrates you.
            </p>
            <p>
                Maybe it's a common utility that always breaks. Maybe it's a slow, bloated program that does too much for its own good. Or maybe it's a program that never caught on because the design was too confusing. Whatever the case, this is your chance to replace it with something new.
            </p>
            <p>
                The rules for the jam are flexible. You can participate alone or with a team, and for as much of the time as your schedule allows. And there's no winner - our goal is to kickstart meaningful projects of all kinds.
            </p>
        </div>

        <div id="showcase-outer-container" class="bg-black-20 pt4 pb3 pb4-ns">
            <div class="section mw8 margin-center ph3 ph4-l">
                <h2>Showcase</h2>
                <p>
                    These screenshots and videos were shared in #jam-showcase on our <a href="https://discord.gg/hmn" target="_blank">Discord</a>. Join us!
                </p>
                <div id="showcase-container" class="mw8 center-layout mh2 mh0-ns"></div>
            </div>
        </div>

        <div class="section flex-fair mw8 margin-center ph3 ph4-l mv4">
            <h2>Why reinvent the wheel?</h2>
            <p>
                How can you reinvent something that's never been invented?
            </p>
            <p>
                To “reinvent the wheel” is to solve a problem that’s already been solved. But most problems in computing <em>haven’t</em> been solved, at least not very well. After all, computers have only been around for about 80 years - that’s one person's lifetime. Most of the tech you use is essentially the first draft.
            </p>
            <p>
                Despite this, many people seem to think that we've hit the ceiling. They criticize others for questioning the assumptions that got us here today. And they ignorantly assume that what we have <em>must</em> be good, because otherwise why would we be using it?
            </p>
            <p>
                If your bike had square wheels, you'd want to reinvent them too. So let's take the "square wheels" that we have today, and make them better!
            </p>
        </div>

        <div class="bg-black-20 pt4 pb3 pb4-ns">
            <div class="section mw8 margin-center ph3 ph4-l">
                <h2>Details</h2>
                <p>
                    The jam takes place from Monday, September 27 through Sunday, October 3. Here's how you can participate:
                </p>
                
                <h3>Pick a project.</h3>
                <p>
                    Find a project idea that excites you! Hopefully there's a project that's always been nagging at you, but if not, you can check out our list of <a href="https://handmade.network/forums/jam/t/8075-need_project_ideas_for_the_jam_start_here...">starter ideas</a> for inspiration.
                </p>
                <p>
                    Then visit <a href="https://handmade.network/forums/jam/t/8074-jam_project_ideas___teams%2521">this forum thread</a> and make a post letting us know that you're participating. Not only does this help us plan the event, but it is also an opportunity for you to find a team or just get people excited about your project. Also, if you <a href="https://handmade.network/settings#discord">link your Discord account</a> from your profile settings, we will give you a special role on our Discord server, and any content you share on Discord can be highlighted here on the website as well.
                </p>
                <p>
                    If you have some tech that you prefer to use, feel free to use it. Otherwise, you can use one of our <a href="https://github.com/HandmadeNetwork/jam_templates" target="_blank">app templates</a> as a starting point, or chat with us on Discord and we can help you find a setup that works for you.
                </p>

                <h3>Participate.</h3>
                <p>
                    Build your program over the course of the week. Sharing your work in progress is highly recommended - you can post here on the forums, discuss ideas in #jams and #jam-showcase on the Discord, or share your work on Twitch or Twitter using the hashtag <b>#hmnjam</b>. If you've linked your Discord account, content shared in #jam-showcase on the Discord will be highlighted right here on this page!
                </p>

                <h3>Submit your work!</h3>
                <p>
                    At the end of the jam, you can submit your project by creating a post in the <a href="https://handmade.network/forums/jam" target="_blank">Wheel Reinvention Jam</a> subforum here on the website. The specific rules of the submission can be found below.
                </p>

                <h3>Rules</h3>
                <ul>
                    <li>Any tech is allowed, but we encourage you to use only use what you really need. If you want some lightweight templates to get you started, check out our <a href="https://github.com/HandmadeNetwork/jam_templates" target="_blank">app templates</a>.</li>
                    <li>Work solo or with a team.</li>
                    <li>
                        <p>Submit your work by the end of October 3 in your local timezone.</p>
                        <ul>
                            <li>Create a thread in the <a href="https://handmade.network/forums/jam" target="_blank">Wheel Reinvention Jam</a> subforum.</li>
                            <li>Provide a description of your project, for those unfamiliar. And please share some closing thoughts - did it turn out how you hoped? What did you learn? If you were to do this for real, what would you change?</li>
                            <li>
                                <p>
                                    Your submission post is required to have multiple screenshots of your software in action, and ideally should include a demo video. It doesn’t need to be fancy, but people should be able to see it without needing to run the actual program.
                                </p>
                                <p>
                                    We recommend ShareX for recording desktop video on Windows. On Mac, just press ⌘-Option-5 and record a video, or use QuickTime.
                                </p>
                            </li>
                            <li>If at all possible, please provide a way for people to either build or download your program. While publishing your source code is not required, it is strongly encouraged so that we can all learn from each other's work.</li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        
        <div class="flex-ns flex-row-ns mw8 margin-center ph3 ph4-l mv4">
            <div class="section flex-fair mb4 mb0-ns">
                <h2>Make it by hand.</h2>
                <p>
                    Since you're building something new, turn a critical eye to your tech. Rebuild the things that need rebuilding. Cross boundaries no one else has crossed. Build what you need, not what you think you’ll need.
                </p>
                <p>
                    Of course, this is a jam, so don't waste time on things that don't matter. You should freely use other people’s code and other people’s tools. You only want to reinvent one wheel, not all of them at once!
                </p>
                <p>
                    No tech is off-limits; use what makes sense for you. But don’t use things blindly, and always be watching for where your tools hold you back.
                </p>
            </div>
            <div class="section flex-fair ml4-m ml5-l">
                <h2>Don't just rebuild. Reinvent.</h2>
                <p>
                    Don’t just mimic existing work. Don’t settle for “the same, but better”. If you're going to bother building something new, it should be <em>truly new</em>. Otherwise, you'll probably fail the same way your predecessors did.
                </p>
                <p>
                    Instead, find a unique angle. Think about where existing tools have let you down. What would fit better into your own personal workflow? What did you want when you were first learning? What parts of the existing tools are worth keeping, and what should be left behind?
                </p>
            </div>
        </div>

        <div class="mw8 margin-center ph3-m ph4-l">
            {{ template "footer.html" . }}
        </div>
    </div>

    {{ template "showcase_templates.html" }}

    <!-- Copy-pasted and mangled from showcase.html  -->
    <script>
        const ROW_HEIGHT = 300;
        const ITEM_SPACING = 4;

        const showcaseItems = JSON.parse("{{ .ShowcaseItemsJSON }}");
        const addThumbnailFuncs = new Array(showcaseItems.length);

        const showcaseOuterContainer = document.querySelector('#showcase-outer-container');
        let showcaseContainer = document.querySelector('#showcase-container');

        showcaseOuterContainer.classList.toggle('dn', showcaseItems.length === 0);

        const itemElements = []; // array of arrays
        for (let i = 0; i < showcaseItems.length; i++) {
            const item = showcaseItems[i];

            const [itemEl, addThumbnail] = makeShowcaseItem(item);
            itemEl.container.setAttribute('data-index', i);
            itemEl.container.setAttribute('data-date', item.date);

            addThumbnailFuncs[i] = addThumbnail;
            
            itemElements.push(itemEl.container);
        }

        function layout() {
            const width = showcaseContainer.getBoundingClientRect().width;
            showcaseContainer = emptyElement(showcaseContainer);
            
            function addRow(itemEls, rowWidth, container) {
                const totalSpacing = ITEM_SPACING * (itemEls.length - 1);
                const scaleFactor = (width / Math.max(rowWidth, width));

                const row = document.createElement('div');
                row.classList.add('flex');
                row.classList.toggle('justify-between', rowWidth >= width);
                row.style.marginBottom = `${ITEM_SPACING}px`;
                
                for (const itemEl of itemEls) {
                    const index = parseInt(itemEl.getAttribute('data-index'), 10);
                    const item = showcaseItems[index];

                    const aspect = item.width / item.height;
                    const baseWidth = (aspect * ROW_HEIGHT) * scaleFactor;
                    const actualWidth = baseWidth - (totalSpacing / itemEls.length);

                    itemEl.style.width = `${actualWidth}px`;
                    itemEl.style.height = `${scaleFactor * ROW_HEIGHT}px`;
                    itemEl.style.marginRight = `${ITEM_SPACING}px`;

                    row.appendChild(itemEl);
                }

                container.appendChild(row);
            }

            let rowItemEls = [];
            let rowWidth = 0;

            for (const itemEl of itemElements) {
                const index = parseInt(itemEl.getAttribute('data-index'), 10);
                const item = showcaseItems[index];
                
                const aspect = item.width / item.height;
                rowWidth += aspect * ROW_HEIGHT;

                rowItemEls.push(itemEl);

                if (rowWidth > width) {
                    addRow(rowItemEls, rowWidth, showcaseContainer);

                    rowItemEls = [];
                    rowWidth = 0;
                }
            }

            addRow(rowItemEls, rowWidth, showcaseContainer);
        }

        function loadImages() {
            const items = showcaseContainer.querySelectorAll('.showcase-item');
            for (const item of items) {
                const i = parseInt(item.getAttribute('data-index'), 10);
                addThumbnailFuncs[i]();
            }
        }

        layout();
        layout(); // scrollbars are fun!!

        loadImages();

        window.addEventListener('resize', () => {
            layout();
        });
    </script>
</body>

</html>
