Skip to content

Add repo selector #17

@chartgerink

Description

@chartgerink

I want to still add a way for people to select the repository they want to contribute to. This requires loading all the repositories on which the application is installed, and providing a way to select them.

I previously implemented something that worked in the local development, but broke in the deployment because of netlify function security protocols. Old code included in the details.

  const [data, setData] = useState<any[]>([])

  useEffect(() => {
    fetch('/.netlify/functions/retrieve-installed-apps')
      .then((response) => response.json())
      .then((data) => {
        console.log(data)
        setData(data)
      })
  }, [])
....
 {!!data
             ? data.map((project) => ( 
            <li
                    key={project.repo}
                    className="col-span-1 flex rounded-md shadow-sm"
                  >
                    <div className="flex flex-1 items-center justify-between truncate rounded-r-md border-b border-r border-t border-gray-200 bg-white">
                      <img
                        className={classNames(
                          project.bgColor,
                          'contain flex w-16 flex-shrink-0 items-center justify-center rounded-l-md text-sm font-medium text-white'
                        )}
                        src={project.avatar}
                        alt={`Avatar of ${project.handle}, the group behind ${project.repo}`}
                      />
                      <div className="flex-1 truncate px-4 py-2 text-sm">
                        <a
                          href={project.href}
                          className="font-medium text-gray-900 hover:text-gray-600"
                        >
                          {project.repo}
                        </a>
                      </div>
                    </div>
                  </li>
            ))
            : ''}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions