Skip to content

Commit

Permalink
chore: remove leftover code
Browse files Browse the repository at this point in the history
  • Loading branch information
zugdev committed Jan 9, 2025
1 parent 4ba40f3 commit a81ac5b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 62 deletions.
59 changes: 0 additions & 59 deletions src/home/fetch-github/filter-and-display-notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,6 @@ export type Options = {
ordering: "normal" | "reverse";
};

// start at view based on URL
export let isProposalOnlyViewer = new URLSearchParams(window.location.search).get("proposal") === "true";

export const viewToggle = document.getElementById("view-toggle") as HTMLInputElement;

if (isProposalOnlyViewer) {
viewToggle.checked = true;
}

if (!viewToggle) {
throw new Error("Could not find view toggle");
}

// if the Directory/Proposals toggle is clicked re-render the issues
viewToggle.addEventListener("click", () => {
isProposalOnlyViewer = !isProposalOnlyViewer;

// If you are in a preview, close it
closeModal();
});

// function getProposalsOnlyFilter(getProposals: boolean) {
// return (notification: GitHubAggregated) => {
// if (!notification.issue.labels) return false;

// const hasPriceLabel = notification.issue.labels.some((label) => {
// if (typeof label === "string") return false;
// return label.name?.startsWith("Price: ") || label.name?.startsWith("Price: ");
// });

// return getProposals ? !hasPriceLabel : hasPriceLabel;
// };
// }

// function filterIssuesByOrganization(issues: GitHubNotifications): GitHubNotifications {
// // get organization name from first thing after / in URL
// const pathSegments = window.location.pathname.split("/").filter(Boolean);
// const urlOrgName = pathSegments.length > 0 ? pathSegments[0] : null;

// // if there is no organization name in the URL, return all issues
// if (!urlOrgName) return issues;

// // filter issues by matching the URL organization name with the issue's organization name
// const filteredIssues = issues.filter((issue) => {
// const [issueOrgName] = issue.repository_url.split("/").slice(-2);
// return issueOrgName === urlOrgName;
// });

// // if no issues match the organization, redirect to home
// if (filteredIssues.length === 0) {
// console.log(`No issues found for organization "${urlOrgName}". Redirecting to the home page.`);
// window.location.href = "/";
// }

// renderOrgHeaderLabel(urlOrgName);

// return filteredIssues;
// }

// checks the cache's integrity, sorts issues, checks Directory/Proposals toggle, renders them and applies avatars
export async function displayNotifications({
sorting,
Expand Down
3 changes: 1 addition & 2 deletions src/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { grid } from "../the-grid";
import { authentication } from "./authentication";
import { displayNotifications } from "./fetch-github/filter-and-display-notifications";
import { fetchAvatars } from "./fetch-github/fetch-avatar";
import { fetchAllNotifications, fetchIssueNotifications, fetchPullRequestNotifications } from "./fetch-github/fetch-data";
import { GitHubNotifications } from "./github-types";
import { fetchAllNotifications } from "./fetch-github/fetch-data";
import { readyToolbar } from "./ready-toolbar";
import { renderServiceMessage } from "./render-service-message";
import { renderErrorInModal } from "./rendering/display-popup-modal";
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
d="M132 41.1c0-2.3-1.3-4.5-3.3-5.7L69.4 1.2c-1-.6-2.1-.9-3.3-.9-1.1 0-2.3.3-3.3.9L3.6 35.4c-2 1.2-3.3 3.3-3.3 5.7v68.5c0 2.3 1.3 4.5 3.3 5.7l59.3 34.2c2 1.2 4.5 1.2 6.5 0l59.3-34.2c2-1.2 3.3-3.3 3.3-5.7V41.1zm-11.9 62.5c0 2.7-1.4 5.2-3.7 6.5l-46.6 27.5c-1.1.7-2.4 1-3.7 1s-2.5-.3-3.7-1l-46.6-27.5c-2.3-1.3-3.7-3.8-3.7-6.5V54.1c0-1.2.6-2.4 1.7-3 1.1-.6 2.3-.6 3.4 0l8 4.7c1.9 1.1 3 3.3 4.4 5.8.3.5.5 1 .8 1.4 3.5 6.3 5.2 13 6.8 19.5 3 11.9 6 24.2 21.3 28.2 5 1.3 10.4 1.3 15.4 0 15.2-4 18.3-16.3 21.3-28.2C96.8 76 98.5 69.3 102 63c.3-.5.5-1 .8-1.4 1.3-2.5 2.5-4.6 4.4-5.8l8-4.7c1-.6 2.3-.6 3.4 0s1.7 1.7 1.7 3v49.5zM62.6 13.7c2.2-1.3 4.9-1.3 7.1 0L110 37.6c1 .6 1.6 1 1.6 2.2 0 1.2-.6 1.9-1.6 2.5l-7.7 4.6c-3.4 2-5.1 5.2-6.6 8.1l-.1.2c-.2.4-.4.7-.6 1.1-3.8 6.8-6.6 14-8.2 20.4C83.6 89.1 82.4 97.3 72 100c-1.9.5-3.9.7-5.8.7-2 0-3.9-.3-5.8-.7C50 97.3 48.7 89.1 45.6 76.6 44 70.2 41.2 63 37.4 56.2c-.2-.3-.4-.7-.6-1l-.1-.3c-1.5-2.8-3.3-6.1-6.6-8.1l-7.7-4.6c-1-.6-1.6-1.3-1.6-2.5s.6-1.6 1.6-2.2l40.2-23.8z"
></path></svg
><span
><span class="full">Ubiquity DAO | </span><span class="mid">Notifications<input type="checkbox" id="view-toggle" /></span></span></div></label
><span class="full">Ubiquity DAO | </span><span class="mid">Notifications</span></span></div></label
><div id="filters" class="filters-container"></div>
<div id="authentication"></div>
</div>
Expand Down

0 comments on commit a81ac5b

Please sign in to comment.