Skip to content

Commit

Permalink
Add randomized widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-r-bigelow committed Feb 23, 2024
1 parent fcfc4cf commit c0cb706
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build and Deploy
on: [push]
# TODO: limit this flow to when we push to main
permissions:
contents: write
jobs:
Expand Down
24 changes: 24 additions & 0 deletions components/randomAvatars.ojs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
peopleFile = FileAttachment('localData/people.json').json();

function randomAvatars(teamName) {
console.log(peopleFile, teamName);
const team = peopleFile.data.organization.teams.nodes.find(
(team) => team.name === teamName
);
const people = team.members.nodes
.map(({ id }) =>
peopleFile.data.organization.membersWithRole.nodes.find(
(person) => person.id === id
)
)
.sort(() => 2 * Math.random() - 1);
const container = d3.create('div')
.classed('randomAvatars', true);
container.selectAll('img')
.data(people)
.enter()
.append('img')
.attr('src', person => person.avatarUrl)
.attr('title', person => person.name);
return container.node();
}
16 changes: 14 additions & 2 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
title: "Research Bazaar–Arizona"
page-layout: full
css: styles/index.css
execute:
echo: false
---

```{ojs}
import { randomAvatars } from './components/randomAvatars.ojs';
```


## What we do

Expand Down Expand Up @@ -41,7 +47,10 @@ _(Optionally) RSVP for our events at Meetup: [Our MeetUp](https://www.meetup.com
**What**: Whether you're debugging code or need ideas for how to introduce programming into your research, Coffee and Code is a great place to receive help and share knowledge! No specific problem? No worries -- join us at Coffee and Code to chit chat with other researchers in the morning. Coffee and Code is the best way to start your Wednesday!

**Who you're likely to see**:
{% include "./partials/randomAvatars.html", teamName: "Coffee and Code" %}

```{ojs}
randomAvatars("Coffee and Code");
```

:::

Expand All @@ -60,7 +69,10 @@ _(Optionally) RSVP for our events at Meetup: [Our MeetUp](https://www.meetup.com
**What**: Hacking + Happy Hour = HackyHour! Every week, researchers, data scientists, and programmers around campus get together. Some people bring their programming problems to get help from those with more experience. Those without projects come to discuss their research, brainstorm new ideas, try out new technologies, or chit chat about data science!

**Who you're likely to see**:
{% include "./partials/randomAvatars.html", teamName: "Hacky Hour" %}

```{ojs}
randomAvatars("Hacky Hour");
```

:::

Expand Down

0 comments on commit c0cb706

Please sign in to comment.