
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@bagaking/dayboxing
Advanced tools
DayBoxing 是一个基于 React 的时间管理可视化组件库,它实现了 QH 分析法则,帮助你直观地展示和分析每日时间分配。
npm install @bagaking/dayboxing
# or yarn install @bagaking/dayboxing
# or pnpm install @bagaking/dayboxing
最简单的使用方式是通过时间类型数组定义模式:
import { DayBoxing } from '@bagaking/dayboxing';
function App() {
return (
<DayBoxing
patterns={[
// 每个字符串代表一个小时的时间类型
["sleep", "sleep", "sleep", "work", "work", "life", "relax"]
]}
dates={["2024-03-15"]}
/>
);
}
使用对象方式可以定义更详细的时间块信息:
const pattern = {
startHour: -3, // 从前一天 21:00 开始
blocks: [
{ type: "sleep", duration: 8, comment: "Night sleep" },
{ type: "work", duration: 4, comment: "Morning focus" },
{ type: "life", duration: 1, comment: "Lunch break" },
{ type: "work", duration: 4, comment: "Afternoon work" },
{ type: "relax", duration: 4, comment: "Evening activities" }
]
};
function App() {
return (
<DayBoxing
patterns={[pattern]}
dates={["2024-03-15"]}
editable={true}
/>
);
}
const pattern = {
startHour: -3, // 从前一天 21:00 开始
blocks: [
"sleep", "sleep", "sleep", "sleep", "sleep", "sleep",
{ type: "sleep", duration: 2, comment: "Dream" },
{ type: "work", duration: 4, comment: "Morning focus" },
{ type: "life", duration: 1, comment: "Lunch break" },
{ type: "work", duration: 4, comment: "Afternoon work" },
{ type: "relax", duration: 4, comment: "Evening activities" }
]
};
## 高级特性
### 主题定制
```tsx
const theme = {
colors: {
sleep: "#A78BFA",
work: "#60A5FA",
life: "#34D399",
relax: "#FBBF24",
background: "#ffffff",
text: "#1f2937",
},
cellSize: 40,
gap: 2,
borderRadius: 4,
};
<DayBoxing theme={theme} {...props} />
const shortcuts = {
s: "sleep",
w: "work",
l: "life",
r: "relax"
};
<DayBoxing
shortcuts={shortcuts}
editable={true}
{...props}
/>
const CustomHour = ({ hour, date }) => (
<div className="hour-cell">
<div className="time">{hour.hour}:00</div>
{hour.comment && (
<div className="comment">{hour.comment}</div>
)}
</div>
);
const CustomDateLabel = ({ date }) => (
<div className="date-label">
{new Date(date).toLocaleDateString()}
</div>
);
<DayBoxing
renderHour={CustomHour}
renderDateLabel={CustomDateLabel}
{...props}
/>
function App() {
const handleHourChange = (event) => {
const { hour, date, oldType, newType } = event;
console.log(`Hour ${hour} changed: ${oldType} -> ${newType}`);
};
const handlePatternEdit = (event) => {
const { date, type, payload } = event;
console.log(`Pattern edited: ${type}`, payload);
};
return (
<DayBoxing
onHourChange={handleHourChange}
onPatternEdit={handlePatternEdit}
{...props}
/>
);
}
| 属性 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| patterns | (DayPattern | string[])[] | ✓ | - | 时间模式数组 |
| dates | string[] | ✓ | - | 日期数组 |
| direction | 'horizontal' | 'vertical' | 'horizontal' | 布局方向 | |
| theme | ThemeConfig | defaultTheme | 主题配置 | |
| editable | boolean | false | 是否可编辑 | |
| shortcuts | Record<string, HourType> | {} | 快捷映射 | |
| showDateLabel | boolean | true | 是否显示日期标签 | |
| onHourChange | (event: HourChangeEvent) => void | - | 时间类型变更回调 | |
| onPatternEdit | (event: PatternEditEvent) => void | - | 模式编辑回调 | |
| renderHour | (hour: HourData, date: string) => ReactNode | - | 自定义小时渲染 | |
| renderDateLabel | (date: string) => ReactNode | - | 自定义日期标签渲染 |
interface DayPattern {
startHour?: number;
blocks: Array<{
type: HourType;
duration: number;
comment?: string;
}>;
}
type HourType = "sleep" | "work" | "life" | "relax";
interface HourChangeEvent {
hour: number;
date: string;
oldType: HourType;
newType: HourType;
comment?: string;
}
interface PatternEditEvent {
date: string;
type: "moveStart" | "addBlock" | "removeBlock" | "updateBlock";
payload: any;
}
DayBoxing 基于 QH 分析法则,将一天划分为四个时间段(A/B/C/F),用于分析时间分配的合理性。
每个时间段都会被自动分析并归类为以下模式之一:
Full Part (FP)
Mix Part (MP)
Balance Part (BP)
Chaos Part (CP)
// 一个良好的时间分配示例
const pattern = {
startHour: -3, // 21:00 开始
blocks: [
{ type: "sleep", duration: 8 }, // A段: S(fp)
{ type: "work", duration: 6 }, // B段: W-B(mp)
{ type: "life", duration: 1 },
{ type: "work", duration: 4 }, // C段: W-R(bp)
{ type: "relax", duration: 3, comment: "Evening activities" },
{ type: "relax", duration: 2 } // F段: R(fp)
]
};
MIT © bagaking
FAQs
A React component library for DayBoxing time management visualization
We found that @bagaking/dayboxing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.