Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into tooling-dashboard/…
Browse files Browse the repository at this point in the history
…staked-vesting-overview
  • Loading branch information
panteleymonchuk committed Dec 2, 2024
2 parents 0ec2ca6 + f3388e1 commit 436344f
Show file tree
Hide file tree
Showing 38 changed files with 677 additions and 346 deletions.
84 changes: 42 additions & 42 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# Default fallback, if no other path below this matches
* @iotaledger/l1-core @iotaledger/core-node @iotaledger/core-consensus
* @iotaledger/sc-platform @iotaledger/core-protocol

# Everything within the SDK folder
/sdk/ @iotaledger/boxfish @iotaledger/l1-core @iotaledger/tooling
/sdk/ @iotaledger/tooling

# Changes to the genesis builder should be approved by Konstantinos or Mirko at least
/crates/iota-genesis-builder/ @kodemartin @miker83z

# vm-language team
/iota-execution/ @miker83z @valeriyr
/external-crates/ @miker83z @valeriyr
/iota-execution/ @iotaledger/vm-language
/external-crates/ @iotaledger/vm-language

# l1-core-infra team
/docker/ @iotaledger/l1-core-infra @iotaledger/core-node @iotaledger/devops-admin
/crates/iota-json-rpc*/ @iotaledger/l1-core-infra
/crates/iota-graphql*/ @iotaledger/l1-core-infra
/crates/iota-indexer*/ @iotaledger/l1-core-infra
/crates/iota-data-ingestion*/ @iotaledger/l1-core-infra
/crates/iota-analytics-indexer/ @iotaledger/l1-core-infra
# infrastructure team
/docker/ @iotaledger/infrastructure @iotaledger/node @iotaledger/devops-admin
/crates/iota-json-rpc*/ @iotaledger/infrastructure
/crates/iota-graphql*/ @iotaledger/infrastructure
/crates/iota-indexer*/ @iotaledger/infrastructure
/crates/iota-data-ingestion*/ @iotaledger/infrastructure
/crates/iota-analytics-indexer/ @iotaledger/infrastructure

# core-node team
/crates/iota-archival/ @iotaledger/core-node
/crates/iota-authority-aggregation/ @iotaledger/core-node @iotaledger/core-consensus
/crates/iota-config/ @iotaledger/core-node
/crates/iota-core/ @iotaledger/core-node @iotaledger/core-consensus
/crates/iota-network/ @iotaledger/core-node
/crates/iota-network-stack/ @iotaledger/core-node
/crates/iota-node/ @iotaledger/core-node
/crates/iota-types/ @iotaledger/core-node @iotaledger/l1-core
/crates/iota-protocol-config/ @iotaledger/core-node @iotaledger/l1-core
/crates/iota-protocol-config-macros/ @iotaledger/core-node @iotaledger/l1-core
/crates/iota-rest-api/ @iotaledger/core-node @iotaledger/l1-core-infra
/crates/iota-snapshot/ @iotaledger/core-node
/crates/iota-storage/ @iotaledger/core-node
# node team
/crates/iota-archival/ @iotaledger/node
/crates/iota-authority-aggregation/ @iotaledger/node @iotaledger/consensus
/crates/iota-config/ @iotaledger/node
/crates/iota-core/ @iotaledger/node @iotaledger/consensus
/crates/iota-network/ @iotaledger/node
/crates/iota-network-stack/ @iotaledger/node
/crates/iota-node/ @iotaledger/node
/crates/iota-types/ @iotaledger/node @iotaledger/sc-platform
/crates/iota-protocol-config/ @iotaledger/node @iotaledger/sc-platform
/crates/iota-protocol-config-macros/ @iotaledger/node @iotaledger/sc-platform
/crates/iota-rest-api/ @iotaledger/node @iotaledger/infrastructure
/crates/iota-snapshot/ @iotaledger/node
/crates/iota-storage/ @iotaledger/node

# core-consensus team
/consensus/ @iotaledger/core-consensus
# consensus team
/consensus/ @iotaledger/consensus

# dev-tools team
/crates/iota/ @iotaledger/dev-tools
Expand All @@ -45,21 +45,21 @@
/crates/iota-transaction-builder/ @iotaledger/dev-tools

# Frontend apps to be looked after by Boxfish Studio or the tooling team
/apps/ @iotaledger/boxfish @iotaledger/tooling
/dapps/ @iotaledger/boxfish @iotaledger/tooling
/linting/ @iotaledger/boxfish @iotaledger/tooling
/.husky/ @iotaledger/boxfish @iotaledger/tooling
/.changeset/ @iotaledger/boxfish @iotaledger/tooling
.eslintrc.js @iotaledger/boxfish @iotaledger/tooling
.lintstagedrc.json @iotaledger/boxfish @iotaledger/tooling
.npmrc @iotaledger/boxfish @iotaledger/tooling
.prettierignore @iotaledger/boxfish @iotaledger/tooling
graphql.config.ts @iotaledger/boxfish @iotaledger/tooling
package.json @iotaledger/boxfish @iotaledger/tooling
pnpm-workspace.yaml @iotaledger/boxfish @iotaledger/tooling
prettier.config.js @iotaledger/boxfish @iotaledger/tooling
turbo.json @iotaledger/boxfish @iotaledger/tooling
vercel.json @iotaledger/boxfish @iotaledger/tooling
/apps/ @iotaledger/tooling
/dapps/ @iotaledger/tooling
/linting/ @iotaledger/tooling
/.husky/ @iotaledger/tooling
/.changeset/ @iotaledger/tooling
.eslintrc.js @iotaledger/tooling
.lintstagedrc.json @iotaledger/tooling
.npmrc @iotaledger/tooling
.prettierignore @iotaledger/tooling
graphql.config.ts @iotaledger/tooling
package.json @iotaledger/tooling
pnpm-workspace.yaml @iotaledger/tooling
prettier.config.js @iotaledger/tooling
turbo.json @iotaledger/tooling
vercel.json @iotaledger/tooling

# Docs and examples are for DevEx to approve upon
/docs/ @iotaledger/devx
Expand Down
6 changes: 3 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Documentation:
documentation:
- changed-files:
- any-glob-to-any-file: docs/content/**/*
iota-explorer:
explorer:
- changed-files:
- any-glob-to-any-file: explorer/**/*
- any-glob-to-any-file: apps/explorer/**/*
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ reqwest = { version = "0.12", default-features = false, features = ["http2", "js
roaring = "0.10.6"
rocksdb = { version = "0.21.0", default-features = false, features = ["snappy", "lz4", "zstd", "zlib", "multi-threaded-cf"] }
rstest = "0.16.0"
rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "ring"] }
rustls = { version = "0.23.18", default-features = false, features = ["std", "tls12", "ring"] }
schemars = { version = "0.8.21", features = ["either"] }
scopeguard = "1.1"
serde = { version = "1.0.144", features = ["derive", "rc"] }
Expand Down
86 changes: 59 additions & 27 deletions apps/core/src/components/providers/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { PropsWithChildren, useState, useEffect, useCallback } from 'react';
import { Theme } from '../../enums';
import { PropsWithChildren, useState, useEffect } from 'react';
import { Theme, ThemePreference } from '../../enums';
import { ThemeContext } from '../../contexts';

interface ThemeProviderProps {
Expand All @@ -12,40 +12,72 @@ interface ThemeProviderProps {
export function ThemeProvider({ children, appId }: PropsWithChildren<ThemeProviderProps>) {
const storageKey = `theme_${appId}`;

const getSystemTheme = () =>
window.matchMedia('(prefers-color-scheme: dark)').matches ? Theme.Dark : Theme.Light;
const getSystemTheme = () => {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? Theme.Dark : Theme.Light;
};

const getInitialTheme = () => {
if (typeof window === 'undefined') {
return Theme.System;
} else {
const storedTheme = localStorage?.getItem(storageKey);
return storedTheme ? (storedTheme as Theme) : Theme.System;
}
const getThemePreference = () => {
const storedTheme = localStorage?.getItem(storageKey) as ThemePreference | null;
return storedTheme ? storedTheme : ThemePreference.System;
};

const [theme, setTheme] = useState<Theme>(getInitialTheme);
const [systemTheme, setSystemTheme] = useState<Theme>(Theme.Light);
const [themePreference, setThemePreference] = useState<ThemePreference>(ThemePreference.System);
const [isLoadingPreference, setIsLoadingPreference] = useState(true);

const applyTheme = useCallback((currentTheme: Theme) => {
const selectedTheme = currentTheme === Theme.System ? getSystemTheme() : currentTheme;
const documentElement = document.documentElement.classList;
documentElement.toggle(Theme.Dark, selectedTheme === Theme.Dark);
documentElement.toggle(Theme.Light, selectedTheme === Theme.Light);
// Load the theme values on client
useEffect(() => {
if (typeof window === 'undefined') return;

setSystemTheme(getSystemTheme());
setThemePreference(getThemePreference());

// Make the theme preference listener wait
// until the preference is loaded in the next render
setIsLoadingPreference(false);
}, []);

// When the theme preference changes..
useEffect(() => {
if (typeof window === 'undefined') return;
if (typeof window === 'undefined' || isLoadingPreference) return;

// Update localStorage with the new preference
localStorage.setItem(storageKey, themePreference);

localStorage.setItem(storageKey, theme);
applyTheme(theme);
// In case of SystemPreference, listen for system theme changes
if (themePreference === ThemePreference.System) {
const handleSystemThemeChange = () => {
const systemTheme = getSystemTheme();
setSystemTheme(systemTheme);
};
const systemThemeMatcher = window.matchMedia('(prefers-color-scheme: dark)');
systemThemeMatcher.addEventListener('change', handleSystemThemeChange);
return () => systemThemeMatcher.removeEventListener('change', handleSystemThemeChange);
}
}, [themePreference, storageKey, isLoadingPreference]);

if (theme === Theme.System) {
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)');
const handleSystemThemeChange = () => applyTheme(Theme.System);
systemTheme.addEventListener('change', handleSystemThemeChange);
return () => systemTheme.removeEventListener('change', handleSystemThemeChange);
// Derive the active theme from the preference
const theme = (() => {
switch (themePreference) {
case ThemePreference.Dark:
return Theme.Dark;
case ThemePreference.Light:
return Theme.Light;
case ThemePreference.System:
return systemTheme;
}
}, [theme, applyTheme, storageKey]);
})();

// When the theme (preference or derived) changes update the CSS class
useEffect(() => {
const documentElement = document.documentElement.classList;
documentElement.toggle(Theme.Dark, theme === Theme.Dark);
documentElement.toggle(Theme.Light, theme === Theme.Light);
}, [theme]);

return <ThemeContext.Provider value={{ theme, setTheme }}>{children}</ThemeContext.Provider>;
return (
<ThemeContext.Provider value={{ theme, setThemePreference, themePreference }}>
{children}
</ThemeContext.Provider>
);
}
Loading

0 comments on commit 436344f

Please sign in to comment.