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

Feature: Create basic explorable explanation timeline and flow #858

Merged
merged 21 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added ee/favicon.ico
Empty file.
6,173 changes: 6,173 additions & 0 deletions ee/package-lock.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions ee/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "psat-ai",
"version": "0.0.1",
"description": "Explorable explanations for PSAT",
"main": "index.js",
"scripts": {
"start": "webpack serve --open --mode development",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.25.7",
"@babel/preset-env": "^7.25.7",
"babel-loader": "^9.2.1",
"http-server": "^14.1.1",
"prettier": "^3.3.3",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
},
"dependencies": {
"p5": "^1.11.0"
}
}
Binary file added ee/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions ee/public/icons/arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ee/public/icons/pause-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ee/public/icons/play-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions ee/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Protected Audience</title>
<style>
body {
margin: 0;
padding: 0;
}

.hidden {
display: none;
}

#ps-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: auto;
}

#interest-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}

#user-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}

.play-pause-button {
position: absolute;
right: 10px;
top: 10px;
}

button {
cursor: pointer;
border: none;
background-color: transparent;
padding: 0;
}

button img {
width: 20px;
height: 20px;
}
#canvas-container {
width: 100%;
height: 100%;
position: relative;
}
</style>
</head>

<body>
<main>
<div id="ps-canvas">
<div id="canvas-container">
<div class="play-pause-button">
<button id="play" class="hidden">
<img src="./icons/play-button.png" alt="play" />
</button>
<button id="pause">
<img src="./icons/pause-button.png" alt="pause" />
</button>
</div>
</div>
</div>
<div id="interest-canvas"></div>
<div id="user-canvas"></div>
</main>

<script src="bundle.js"></script>
</body>

</html>
39 changes: 39 additions & 0 deletions ee/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const app = {
timeline: {
isPaused: false,
circlePositions: [],
smallCirclePositions: [],
circlePublisherIndices: [],
currentIndex: 0,
},
auction: {
auctions: [],
},
joinInterestGroup: {
joinings: [],
},
flow: {
intervals: {},
},
utils: {},
p: null,
igp: null,
up: null,
};

export default app;
65 changes: 65 additions & 0 deletions ee/src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const config = {
canvas: {
width: 700,
background: 245,
fontSize: 12,
},
timeline: {
position: { x: 100, y: 50 },
circleProps: {
diameter: 50,
verticalSpacing: 70,
},
stepDelay: 1500,
user: {
width: 30,
height: 30,
},
circles: [
{ type: 'advertiser', website: 'adv1.com', datetime: '2023-10-01 10:00' },
{ type: 'advertiser', website: 'adv2.com', datetime: '2023-10-01 11:00' },
{ type: 'publisher', website: 'pub1.com', datetime: '2023-10-01 12:00' },
{ type: 'advertiser', website: 'adv3.com', datetime: '2023-10-01 13:00' },
{ type: 'advertiser', website: 'adv5.com', datetime: '2023-10-01 13:02' },
{ type: 'publisher', website: 'pub2.com', datetime: '2023-10-01 14:00' },
{ type: 'advertiser', website: 'adv6.com', datetime: '2023-10-01 14:01' },
{ type: 'advertiser', website: 'adv7.com', datetime: '2023-10-01 15:00' },
],
colors: {
visitedBlue: '#1A73E8',
grey: '#808080',
},
},
flow: {
box: { width: 125, height: 100 },
smallBox: { width: 80, height: 50 },
mediumBox: { width: 125, height: 50 },
lineWidth: 100,
lineHeight: 50,
},
rippleEffect: {
ripples: [],
numRipples: 3,
maxRadius: 200,
time: 4000,
speed: 1,
rippled: false,
},
};

export default config;
6 changes: 6 additions & 0 deletions ee/src/icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"user": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjNWY2MzY4Ij48cGF0aCBkPSJNMjM0LTI3NnE1MS0zOSAxMTQtN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