type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
MethodDeclaration |
override async run(notification: INotificationViewItem): Promise<void> {
this.commandService.executeCommand(COLLAPSE_NOTIFICATION, notification);
} | AaronNGray/vscode | src/vs/workbench/browser/parts/notifications/notificationsActions.ts | TypeScript |
MethodDeclaration |
override run(notification: INotificationViewItem): Promise<void> {
return this.clipboardService.writeText(notification.message.raw);
} | AaronNGray/vscode | src/vs/workbench/browser/parts/notifications/notificationsActions.ts | TypeScript |
MethodDeclaration |
protected override async runAction(action: IAction, context: unknown): Promise<void> {
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: action.id, from: 'message' });
if (isNotificationViewItem(context)) {
// Log some additional telemetry specifically for actions
// that are triggered from within notifications.
this.telemetryService.publicLog2<NotificationActionMetrics, NotificationActionMetricsClassification>('notification:actionExecuted', {
id: hash(context.message.original.toString()).toString(),
actionLabel: action.label,
source: context.sourceId || 'core',
silent: context.silent
});
}
// Run and make sure to notify on any error again
try {
await super.runAction(action, context);
} catch (error) {
this.notificationService.error(error);
}
} | AaronNGray/vscode | src/vs/workbench/browser/parts/notifications/notificationsActions.ts | TypeScript |
ClassDeclaration |
export default class Badge extends React.Component<BadgeProps, any> {
static defaultProps = {
prefixCls: 'ant-badge',
scrollNumberPrefixCls: 'ant-scroll-number',
count: null,
showZero: false,
dot: false,
overflowCount: 99,
};
static propTypes = {
count: PropTypes.node,
showZero: PropTypes.bool,
dot: PropTypes.bool,
overflowCount: PropTypes.number,
};
getBadgeClassName() {
const { prefixCls, className, status, children } = this.props;
return classNames(className, prefixCls, {
[`${prefixCls}-status`]: !!status,
[`${prefixCls}-not-a-wrapper`]: !children,
}) as string;
}
isZero() {
const numberedDispayCount = this.getNumberedDispayCount();
return numberedDispayCount === '0' || numberedDispayCount === 0;
}
isDot() {
const { dot, status } = this.props;
const isZero = this.isZero();
return (dot && !isZero) || status;
}
isHidden() {
const { showZero } = this.props;
const displayCount = this.getDispayCount();
const isZero = this.isZero();
const isDot = this.isDot();
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
return (isEmpty || (isZero && !showZero)) && !isDot;
}
getNumberedDispayCount() {
const { count, overflowCount } = this.props;
const displayCount =
(count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
return displayCount as string | number | null;
}
getDispayCount() {
const isDot = this.isDot();
// dot mode don't need count
if (isDot) {
return '';
}
return this.getNumberedDispayCount();
}
getScollNumberTitle() {
const { title, count } = this.props;
if (title) {
return title;
}
return typeof count === 'string' || typeof count === 'number' ? count : undefined;
}
getStyleWithOffset() {
const { offset, style } = this.props;
return offset
? {
right: -parseInt(offset[0] as string, 10),
marginTop: offset[1],
...style,
}
: style;
}
renderStatusText() {
const { prefixCls, text } = this.props;
const hidden = this.isHidden();
return hidden || !text ? null : <span className={`${prefixCls}-status-text`}>{text}</span>;
}
renderDispayComponent() {
const { count } = this.props;
const customNode = count as React.ReactElement<any>;
if (!customNode || typeof customNode !== 'object') {
return undefined;
}
return React.cloneElement(customNode, {
style: {
...this.getStyleWithOffset(),
...(customNode.props && customNode.props.style),
},
});
}
renderBadgeNumber() {
const { count, prefixCls, scrollNumberPrefixCls, status } = this.props;
const displayCount = this.getDispayCount();
const isDot = this.isDot();
const hidden = this.isHidden();
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-multiple-words`]:
!isDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
});
return hidden ? null : (
<ScrollNumber
prefixCls={scrollNumberPrefixCls}
data-show={!hidden}
className={scrollNumberCls}
count={displayCount}
displayComponent={this.renderDispayComponent()} // <Badge status="success" count={<Icon type="xxx" />}></Badge>
title={this.getScollNumberTitle()}
style={this.getStyleWithOffset()}
key="scrollNumber"
/>
);
}
render() {
const {
count,
showZero,
prefixCls,
scrollNumberPrefixCls,
overflowCount,
className,
style,
children,
dot,
status,
text,
offset,
title,
...restProps
} = this.props;
const scrollNumber = this.renderBadgeNumber();
const statusText = this.renderStatusText();
const statusCls = classNames({
[`${prefixCls}-status-dot`]: !!status,
[`${prefixCls}-status-${status}`]: !!status,
});
// <Badge status="success" />
if (!children && status) {
return (
<span {...restProps} className={this.getBadgeClassName()} style={this.getStyleWithOffset()}>
<span className={statusCls} />
<span className={`${prefixCls}-status-text`}>{text}</span>
</span>
);
}
return (
<span {...restProps} className={this.getBadgeClassName()}>
{children}
<Animate
component=""
showProp="data-show"
transitionName={children ? `${prefixCls}-zoom` : ''} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
InterfaceDeclaration |
export interface BadgeProps {
/** Number to show in badge */
count?: React.ReactNode;
showZero?: boolean;
/** Max count to show */
overflowCount?: number;
/** whether to show red dot without number */
dot?: boolean;
style?: React.CSSProperties;
prefixCls?: string;
scrollNumberPrefixCls?: string;
className?: string;
status?: 'success' | 'processing' | 'default' | 'error' | 'warning';
text?: string;
offset?: [number | string, number | string];
title?: string;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
getBadgeClassName() {
const { prefixCls, className, status, children } = this.props;
return classNames(className, prefixCls, {
[`${prefixCls}-status`]: !!status,
[`${prefixCls}-not-a-wrapper`]: !children,
}) as string;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
isZero() {
const numberedDispayCount = this.getNumberedDispayCount();
return numberedDispayCount === '0' || numberedDispayCount === 0;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
isDot() {
const { dot, status } = this.props;
const isZero = this.isZero();
return (dot && !isZero) || status;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
isHidden() {
const { showZero } = this.props;
const displayCount = this.getDispayCount();
const isZero = this.isZero();
const isDot = this.isDot();
const isEmpty = displayCount === null || displayCount === undefined || displayCount === '';
return (isEmpty || (isZero && !showZero)) && !isDot;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
getNumberedDispayCount() {
const { count, overflowCount } = this.props;
const displayCount =
(count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
return displayCount as string | number | null;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
getDispayCount() {
const isDot = this.isDot();
// dot mode don't need count
if (isDot) {
return '';
}
return this.getNumberedDispayCount();
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
getScollNumberTitle() {
const { title, count } = this.props;
if (title) {
return title;
}
return typeof count === 'string' || typeof count === 'number' ? count : undefined;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
getStyleWithOffset() {
const { offset, style } = this.props;
return offset
? {
right: -parseInt(offset[0] as string, 10),
marginTop: offset[1],
...style,
}
: style;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
renderStatusText() {
const { prefixCls, text } = this.props;
const hidden = this.isHidden();
return hidden || !text ? null : <span className={`${prefixCls}-status-text`}>{text}</span>;
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
renderDispayComponent() {
const { count } = this.props;
const customNode = count as React.ReactElement<any>;
if (!customNode || typeof customNode !== 'object') {
return undefined;
}
return React.cloneElement(customNode, {
style: {
...this.getStyleWithOffset(),
...(customNode.props && customNode.props.style),
},
});
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
renderBadgeNumber() {
const { count, prefixCls, scrollNumberPrefixCls, status } = this.props;
const displayCount = this.getDispayCount();
const isDot = this.isDot();
const hidden = this.isHidden();
const scrollNumberCls = classNames({
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-multiple-words`]:
!isDot && count && count.toString && count.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
});
return hidden ? null : (
<ScrollNumber
prefixCls={scrollNumberPrefixCls}
data-show={!hidden}
className={scrollNumberCls}
count={displayCount}
displayComponent={this.renderDispayComponent()} // <Badge status="success" count={<Icon type="xxx" />}></Badge>
title={this.getScollNumberTitle()}
style={this.getStyleWithOffset()}
key="scrollNumber"
/>
);
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
render() {
const {
count,
showZero,
prefixCls,
scrollNumberPrefixCls,
overflowCount,
className,
style,
children,
dot,
status,
text,
offset,
title,
...restProps
} = this.props;
const scrollNumber = this.renderBadgeNumber();
const statusText = this.renderStatusText();
const statusCls = classNames({
[`${prefixCls}-status-dot`]: !!status,
[`${prefixCls}-status-${status}`]: !!status,
});
// <Badge status="success" />
if (!children && status) {
return (
<span {...restProps} className={this.getBadgeClassName()} style={this.getStyleWithOffset()}>
<span className={statusCls} />
<span className={`${prefixCls}-status-text`}>{text}</span>
</span>
);
} | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
MethodDeclaration |
return (
<span {...restProps} className={this.getBadgeClassName()}>
{children}
<Animate
component=""
showProp="data-show"
transitionName={children ? `${prefixCls}-zoom` : '' | Abd-Elrazek/ant-design | components/badge/index.tsx | TypeScript |
ArrowFunction |
([, todo]) => todo > 0 | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([done, todo]) => {
return Math.round(done * 100 / todo);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
extracts => {
return combineLatest([
this.doCollectablesData(),
this.doLogTrackingData(extracts)
]);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([pages, leves, notebookDivision]) => {
return pages.map(page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing') || division.name.en.startsWith('Ornaments');
tab.recipes = tab.recipes.map(entry => {
(entry as any).leves = Object.entries<any>(leves)
.filter(([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
})
.map(([id]) => +id);
return entry;
});
return tab;
});
});
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing') || division.name.en.startsWith('Ornaments');
tab.recipes = tab.recipes.map(entry => {
(entry as any).leves = Object.entries<any>(leves)
.filter(([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
})
.map(([id]) => +id);
return entry;
});
return tab;
});
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing') || division.name.en.startsWith('Ornaments');
tab.recipes = tab.recipes.map(entry => {
(entry as any).leves = Object.entries<any>(leves)
.filter(([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
})
.map(([id]) => +id);
return entry;
});
return tab;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
key => {
return notebookDivision[key].pages.includes(tab.id);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
entry => {
(entry as any).leves = Object.entries<any>(leves)
.filter(([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
})
.map(([id]) => +id);
return entry;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
i => i.itemId === entry.itemId | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([id]) => +id | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([pages, notebookDivision, extracts]) => {
return pages.map(page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing');
tab.items = tab.items.map(item => {
(item as any).nodes = getItemSource(extracts[item.itemId], DataType.GATHERED_BY).nodes
.slice(0, 3)
.map(node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
});
return item;
});
return tab;
});
});
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing');
tab.items = tab.items.map(item => {
(item as any).nodes = getItemSource(extracts[item.itemId], DataType.GATHERED_BY).nodes
.slice(0, 3)
.map(node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
});
return item;
});
return tab;
});
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing');
tab.items = tab.items.map(item => {
(item as any).nodes = getItemSource(extracts[item.itemId], DataType.GATHERED_BY).nodes
.slice(0, 3)
.map(node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
});
return item;
});
return tab;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
item => {
(item as any).nodes = getItemSource(extracts[item.itemId], DataType.GATHERED_BY).nodes
.slice(0, 3)
.map(node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
});
return item;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([minBtnSpearNodes, fishingLog, spearFishingLog, parameters]) => {
const fishingLogData$ = combineLatest(fishingLog.map(entry => {
return this.getFshData(entry.itemId, entry.spot.id).pipe(
map((fshData) => {
const fish: any = {
entry,
id: entry.spot.id,
itemId: entry.itemId,
level: entry.level,
icon: entry.icon,
data: fshData
};
if (parameters[entry.itemId]) {
fish.timed = parameters[entry.itemId].timed;
fish.weathered = parameters[entry.itemId].weathered;
}
return fish;
})
);
}));
const spearFishingLogData$ = combineLatest(spearFishingLog.map(entry => {
const spot = minBtnSpearNodes.find(n => n.items.includes(entry.itemId));
return this.getFshData(entry.itemId, spot.id).pipe(
map((data) => {
return {
entry,
id: spot.id,
itemId: entry.itemId,
level: spot.level,
data: data,
timed: data[0].gatheringNode.limited,
tug: data[0].gatheringNode.tug
};
})
);
}));
return combineLatest([fishingLogData$, spearFishingLogData$]).pipe(
map(([fishingFish, spearFishingFish]) => {
return [fishingFish, spearFishingFish].map(log => {
this.done$.next(this.done$.value + 1);
return log.reduce((display, fish) => {
const displayCopy = { ...display };
let row = displayCopy.tabs.find(e => e.mapId === fish.entry.mapId);
if (row === undefined) {
displayCopy.tabs.push({
id: fish.id,
mapId: fish.entry.mapId,
placeId: fish.entry.placeId,
done: 0,
total: 0,
spots: []
});
row = displayCopy.tabs[displayCopy.tabs.length - 1];
}
const spotId = fish.entry.spot ? fish.entry.spot.id : fish.entry.id;
let spot = row.spots.find(s => s.id === spotId);
if (spot === undefined) {
const coords = fish.entry.spot ? fish.entry.spot.coords : fish.entry.coords;
row.spots.push({
id: spotId,
placeId: fish.entry.zoneId,
mapId: fish.entry.mapId,
done: 0,
total: 0,
coords: coords,
fishes: []
});
spot = row.spots[row.spots.length - 1];
}
const { entry, ...fishRow } = fish;
spot.fishes.push(fishRow);
return displayCopy;
}, { tabs: [], total: 0, done: 0 });
});
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
entry => {
return this.getFshData(entry.itemId, entry.spot.id).pipe(
map((fshData) => {
const fish: any = {
entry,
id: entry.spot.id,
itemId: entry.itemId,
level: entry.level,
icon: entry.icon,
data: fshData
};
if (parameters[entry.itemId]) {
fish.timed = parameters[entry.itemId].timed;
fish.weathered = parameters[entry.itemId].weathered;
}
return fish;
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(fshData) => {
const fish: any = {
entry,
id: entry.spot.id,
itemId: entry.itemId,
level: entry.level,
icon: entry.icon,
data: fshData
};
if (parameters[entry.itemId]) {
fish.timed = parameters[entry.itemId].timed;
fish.weathered = parameters[entry.itemId].weathered;
}
return fish;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
entry => {
const spot = minBtnSpearNodes.find(n => n.items.includes(entry.itemId));
return this.getFshData(entry.itemId, spot.id).pipe(
map((data) => {
return {
entry,
id: spot.id,
itemId: entry.itemId,
level: spot.level,
data: data,
timed: data[0].gatheringNode.limited,
tug: data[0].gatheringNode.tug
};
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
n => n.items.includes(entry.itemId) | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(data) => {
return {
entry,
id: spot.id,
itemId: entry.itemId,
level: spot.level,
data: data,
timed: data[0].gatheringNode.limited,
tug: data[0].gatheringNode.tug
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([fishingFish, spearFishingFish]) => {
return [fishingFish, spearFishingFish].map(log => {
this.done$.next(this.done$.value + 1);
return log.reduce((display, fish) => {
const displayCopy = { ...display };
let row = displayCopy.tabs.find(e => e.mapId === fish.entry.mapId);
if (row === undefined) {
displayCopy.tabs.push({
id: fish.id,
mapId: fish.entry.mapId,
placeId: fish.entry.placeId,
done: 0,
total: 0,
spots: []
});
row = displayCopy.tabs[displayCopy.tabs.length - 1];
}
const spotId = fish.entry.spot ? fish.entry.spot.id : fish.entry.id;
let spot = row.spots.find(s => s.id === spotId);
if (spot === undefined) {
const coords = fish.entry.spot ? fish.entry.spot.coords : fish.entry.coords;
row.spots.push({
id: spotId,
placeId: fish.entry.zoneId,
mapId: fish.entry.mapId,
done: 0,
total: 0,
coords: coords,
fishes: []
});
spot = row.spots[row.spots.length - 1];
}
const { entry, ...fishRow } = fish;
spot.fishes.push(fishRow);
return displayCopy;
}, { tabs: [], total: 0, done: 0 });
});
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
log => {
this.done$.next(this.done$.value + 1);
return log.reduce((display, fish) => {
const displayCopy = { ...display };
let row = displayCopy.tabs.find(e => e.mapId === fish.entry.mapId);
if (row === undefined) {
displayCopy.tabs.push({
id: fish.id,
mapId: fish.entry.mapId,
placeId: fish.entry.placeId,
done: 0,
total: 0,
spots: []
});
row = displayCopy.tabs[displayCopy.tabs.length - 1];
}
const spotId = fish.entry.spot ? fish.entry.spot.id : fish.entry.id;
let spot = row.spots.find(s => s.id === spotId);
if (spot === undefined) {
const coords = fish.entry.spot ? fish.entry.spot.coords : fish.entry.coords;
row.spots.push({
id: spotId,
placeId: fish.entry.zoneId,
mapId: fish.entry.mapId,
done: 0,
total: 0,
coords: coords,
fishes: []
});
spot = row.spots[row.spots.length - 1];
}
const { entry, ...fishRow } = fish;
spot.fishes.push(fishRow);
return displayCopy;
}, { tabs: [], total: 0, done: 0 });
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(display, fish) => {
const displayCopy = { ...display };
let row = displayCopy.tabs.find(e => e.mapId === fish.entry.mapId);
if (row === undefined) {
displayCopy.tabs.push({
id: fish.id,
mapId: fish.entry.mapId,
placeId: fish.entry.placeId,
done: 0,
total: 0,
spots: []
});
row = displayCopy.tabs[displayCopy.tabs.length - 1];
}
const spotId = fish.entry.spot ? fish.entry.spot.id : fish.entry.id;
let spot = row.spots.find(s => s.id === spotId);
if (spot === undefined) {
const coords = fish.entry.spot ? fish.entry.spot.coords : fish.entry.coords;
row.spots.push({
id: spotId,
placeId: fish.entry.zoneId,
mapId: fish.entry.mapId,
done: 0,
total: 0,
coords: coords,
fishes: []
});
spot = row.spots[row.spots.length - 1];
}
const { entry, ...fishRow } = fish;
spot.fishes.push(fishRow);
return displayCopy;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
e => e.mapId === fish.entry.mapId | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
s => s.id === spotId | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([dohTabs, dolTabs, fshTabs]) => {
const finalLogTrackingData = [
...dohTabs,
...dolTabs
];
this.downloadFile('log-tracker-page-data.json', finalLogTrackingData);
this.downloadFile('fishing-log-tracker-page-data.json', fshTabs);
res$.next();
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(job) => {
return this.getCollectables(job).pipe(
map(groups => {
this.done$.next(this.done$.value + 1);
return { job, groups };
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
groups => {
this.done$.next(this.done$.value + 1);
return { job, groups };
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
collectablesPageData => {
const indexed = collectablesPageData.reduce((acc, { job, groups }) => {
return {
...acc,
[job]: groups
};
}, {});
this.downloadFile('collectables-page-data.json', indexed);
res$.next(indexed);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(acc, { job, groups }) => {
return {
...acc,
[job]: groups
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
lazyItems => {
const chunks = _.chunk(Object.keys(lazyItems), 100);
this.totalTodo$.next(chunks.length);
return requestsWithDelay(chunks.map(itemIds => {
return this.http.get<any[]>(`https://www.garlandtools.org/db/doc/item/en/3/${itemIds.join(',')}.json`).pipe(
map(items => this.serializer.deserialize<ItemData>(items.filter(i => !i.error).map(item => item.obj), [ItemData])),
switchMap((items: ItemData[]) => {
if (items.length === 0) {
return of([]);
}
return combineLatest(items.map(data => {
const item: any = {
id: data.item.id
};
return this.extractor.addDataToItem(item, data).pipe(
map(extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
})
);
})).pipe(
first()
);
}),
tap(() => {
this.done$.next(this.done$.value + 1);
})
);
}), 200);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
itemIds => {
return this.http.get<any[]>(`https://www.garlandtools.org/db/doc/item/en/3/${itemIds.join(',')}.json`).pipe(
map(items => this.serializer.deserialize<ItemData>(items.filter(i => !i.error).map(item => item.obj), [ItemData])),
switchMap((items: ItemData[]) => {
if (items.length === 0) {
return of([]);
}
return combineLatest(items.map(data => {
const item: any = {
id: data.item.id
};
return this.extractor.addDataToItem(item, data).pipe(
map(extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
})
);
})).pipe(
first()
);
}),
tap(() => {
this.done$.next(this.done$.value + 1);
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
items => this.serializer.deserialize<ItemData>(items.filter(i => !i.error).map(item => item.obj), [ItemData]) | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
i => !i.error | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
item => item.obj | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(items: ItemData[]) => {
if (items.length === 0) {
return of([]);
}
return combineLatest(items.map(data => {
const item: any = {
id: data.item.id
};
return this.extractor.addDataToItem(item, data).pipe(
map(extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
})
);
})).pipe(
first()
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
data => {
const item: any = {
id: data.item.id
};
return this.extractor.addDataToItem(item, data).pipe(
map(extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
() => {
this.done$.next(this.done$.value + 1);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
items => {
const extracts = [].concat.apply([], items).reduce((acc, i) => {
acc[i.id] = i;
return acc;
}, {});
this.downloadFile('extracts.json', extracts);
res$.next(extracts);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(acc, i) => {
acc[i.id] = i;
return acc;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([collectables, collectablesShops]) => {
return combineLatest(Object.keys(collectables)
.filter(key => {
const collectableEntry = collectables[key];
if (collectableEntry.hwd || !collectableEntry.collectable) {
return false;
}
const job = Object.keys(collectablesShops).find(sKey => {
return collectablesShops[sKey].includes(collectableEntry.shopId);
});
return job !== undefined && (+job + 8) === jobId;
})
.map(key => {
return {
...collectables[key],
itemId: +key,
amount: 1
};
})
.reduce((acc, row) => {
let group = acc.find(accRow => accRow.groupId === row.group);
if (group === undefined) {
acc.push({
groupId: row.group,
collectables: []
});
group = acc[acc.length - 1];
}
group.collectables.push(row);
return acc;
}, [])
.map(group => {
return safeCombineLatest(group.collectables
.sort((a, b) => b.levelMax - a.levelMax)
.map(collectable => {
return combineLatest([
this.getExp(collectable, collectable.base.exp),
this.getExp(collectable, collectable.mid.exp),
this.getExp(collectable, collectable.high.exp)
]).pipe(
switchMap(([expBase, expMid, expHigh]) => {
collectable.expBase = expBase;
collectable.expMid = expMid;
collectable.expHigh = expHigh;
if ([16, 17, 18].includes(jobId)) {
return this.gatheringNodesService.getItemNodes(collectable.itemId, true).pipe(
map(nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
})
);
}
return of(collectable);
})
);
})
).pipe(
map(res => {
group.collectables = res;
return group;
})
);
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
key => {
const collectableEntry = collectables[key];
if (collectableEntry.hwd || !collectableEntry.collectable) {
return false;
}
const job = Object.keys(collectablesShops).find(sKey => {
return collectablesShops[sKey].includes(collectableEntry.shopId);
});
return job !== undefined && (+job + 8) === jobId;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
sKey => {
return collectablesShops[sKey].includes(collectableEntry.shopId);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
key => {
return {
...collectables[key],
itemId: +key,
amount: 1
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(acc, row) => {
let group = acc.find(accRow => accRow.groupId === row.group);
if (group === undefined) {
acc.push({
groupId: row.group,
collectables: []
});
group = acc[acc.length - 1];
}
group.collectables.push(row);
return acc;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
accRow => accRow.groupId === row.group | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
group => {
return safeCombineLatest(group.collectables
.sort((a, b) => b.levelMax - a.levelMax)
.map(collectable => {
return combineLatest([
this.getExp(collectable, collectable.base.exp),
this.getExp(collectable, collectable.mid.exp),
this.getExp(collectable, collectable.high.exp)
]).pipe(
switchMap(([expBase, expMid, expHigh]) => {
collectable.expBase = expBase;
collectable.expMid = expMid;
collectable.expHigh = expHigh;
if ([16, 17, 18].includes(jobId)) {
return this.gatheringNodesService.getItemNodes(collectable.itemId, true).pipe(
map(nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
})
);
}
return of(collectable);
})
);
})
).pipe(
map(res => {
group.collectables = res;
return group;
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(a, b) => b.levelMax - a.levelMax | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
collectable => {
return combineLatest([
this.getExp(collectable, collectable.base.exp),
this.getExp(collectable, collectable.mid.exp),
this.getExp(collectable, collectable.high.exp)
]).pipe(
switchMap(([expBase, expMid, expHigh]) => {
collectable.expBase = expBase;
collectable.expMid = expMid;
collectable.expHigh = expHigh;
if ([16, 17, 18].includes(jobId)) {
return this.gatheringNodesService.getItemNodes(collectable.itemId, true).pipe(
map(nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
})
);
}
return of(collectable);
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
([expBase, expMid, expHigh]) => {
collectable.expBase = expBase;
collectable.expMid = expMid;
collectable.expHigh = expHigh;
if ([16, 17, 18].includes(jobId)) {
return this.gatheringNodesService.getItemNodes(collectable.itemId, true).pipe(
map(nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
})
);
}
return of(collectable);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
res => {
group.collectables = res;
return group;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
(ignored, index) => {
const level = index + 1;
const firstCollectableDigit = Math.floor(collectable.levelMax / 10);
const firstLevelDigit = Math.floor(level / 10);
let nerfedExp = firstCollectableDigit < firstLevelDigit;
if (level % 10 === 0 && level > collectable.levelMax) {
nerfedExp = nerfedExp && (firstCollectableDigit + 1) < firstLevelDigit
|| (level - collectable.levelMax) >= 10
|| collectable.levelMax % 10 === 0;
}
if (nerfedExp) {
return of(10000);
}
return this.lazyData.getRow('paramGrow', collectable.levelMax).pipe(
map(row => row.ExpToNext * ratio / 1000)
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
row => row.ExpToNext * ratio / 1000 | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
expArray => expArray.filter(v => v !== 10000) | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
v => v !== 10000 | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
nodes => {
return uniqBy(nodes.filter(node => node.id === spotId)
.map(node => {
return {
gatheringNode: node,
alarms: this.alarmsFacade.generateAlarms(node)
};
}), entry => entry.gatheringNode.baits && entry.gatheringNode.baits[0])
.slice(0, 3);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
node => node.id === spotId | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
node => {
return {
gatheringNode: node,
alarms: this.alarmsFacade.generateAlarms(node)
};
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
entry => entry.gatheringNode.baits && entry.gatheringNode.baits[0] | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
public doEverything(): void {
this.running = true;
this.doExtracts().pipe(
switchMap(extracts => {
return combineLatest([
this.doCollectablesData(),
this.doLogTrackingData(extracts)
]);
})
).subscribe();
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
public doLogTrackingData(extractsInput?: LazyDataWithExtracts['extracts']): Observable<any> {
const extracts$ = extractsInput ? of(extractsInput) : this.lazyData.getEntry('extracts');
this.running = true;
this.currentLabel = 'Log tracking data';
const res$ = new ReplaySubject<any>();
this.totalTodo$.next(14);
this.done$.next(0);
const dohTabs$ = combineLatest([
this.lazyData.getEntry('craftingLogPages'),
this.lazyData.getEntry('leves'),
this.lazyData.getEntry('notebookDivision')
]).pipe(
map(([pages, leves, notebookDivision]) => {
return pages.map(page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing') || division.name.en.startsWith('Ornaments');
tab.recipes = tab.recipes.map(entry => {
(entry as any).leves = Object.entries<any>(leves)
.filter(([, leve]) => {
return leve.items.some(i => i.itemId === entry.itemId);
})
.map(([id]) => +id);
return entry;
});
return tab;
});
});
})
);
const dolTabs$ = combineLatest([
this.lazyData.getEntry('gatheringLogPages'),
this.lazyData.getEntry('notebookDivision'),
extracts$
]).pipe(
map(([pages, notebookDivision, extracts]) => {
return pages.map(page => {
this.done$.next(this.done$.value + 1);
return page.map(tab => {
(tab as any).divisionId = +Object.keys(notebookDivision).find(key => {
return notebookDivision[key].pages.includes(tab.id);
});
const division = notebookDivision[(tab as any).divisionId];
(tab as any).requiredForAchievement = /\d{1,2}-\d{1,2}/.test(division.name.en) || division.name.en.startsWith('Housing');
tab.items = tab.items.map(item => {
(item as any).nodes = getItemSource(extracts[item.itemId], DataType.GATHERED_BY).nodes
.slice(0, 3)
.map(node => {
return {
gatheringNode: node,
alarms: node.limited ? this.alarmsFacade.generateAlarms(node) : []
};
});
return item;
});
return tab;
});
});
})
);
const fshTabs$ = combineLatest([
this.lazyData.getMinBtnSpearNodesIndex(),
this.lazyData.getEntry('fishingLog'),
this.lazyData.getEntry('spearFishingLog'),
this.lazyData.getEntry('fishParameter')
]).pipe(
switchMap(([minBtnSpearNodes, fishingLog, spearFishingLog, parameters]) => {
const fishingLogData$ = combineLatest(fishingLog.map(entry => {
return this.getFshData(entry.itemId, entry.spot.id).pipe(
map((fshData) => {
const fish: any = {
entry,
id: entry.spot.id,
itemId: entry.itemId,
level: entry.level,
icon: entry.icon,
data: fshData
};
if (parameters[entry.itemId]) {
fish.timed = parameters[entry.itemId].timed;
fish.weathered = parameters[entry.itemId].weathered;
}
return fish;
})
);
}));
const spearFishingLogData$ = combineLatest(spearFishingLog.map(entry => {
const spot = minBtnSpearNodes.find(n => n.items.includes(entry.itemId));
return this.getFshData(entry.itemId, spot.id).pipe(
map((data) => {
return {
entry,
id: spot.id,
itemId: entry.itemId,
level: spot.level,
data: data,
timed: data[0].gatheringNode.limited,
tug: data[0].gatheringNode.tug
};
})
);
}));
return combineLatest([fishingLogData$, spearFishingLogData$]).pipe(
map(([fishingFish, spearFishingFish]) => {
return [fishingFish, spearFishingFish].map(log => {
this.done$.next(this.done$.value + 1);
return log.reduce((display, fish) => {
const displayCopy = { ...display };
let row = displayCopy.tabs.find(e => e.mapId === fish.entry.mapId);
if (row === undefined) {
displayCopy.tabs.push({
id: fish.id,
mapId: fish.entry.mapId,
placeId: fish.entry.placeId,
done: 0,
total: 0,
spots: []
});
row = displayCopy.tabs[displayCopy.tabs.length - 1];
}
const spotId = fish.entry.spot ? fish.entry.spot.id : fish.entry.id;
let spot = row.spots.find(s => s.id === spotId);
if (spot === undefined) {
const coords = fish.entry.spot ? fish.entry.spot.coords : fish.entry.coords;
row.spots.push({
id: spotId,
placeId: fish.entry.zoneId,
mapId: fish.entry.mapId,
done: 0,
total: 0,
coords: coords,
fishes: []
});
spot = row.spots[row.spots.length - 1];
}
const { entry, ...fishRow } = fish;
spot.fishes.push(fishRow);
return displayCopy;
}, { tabs: [], total: 0, done: 0 });
});
})
);
}),
shareReplay(1)
);
combineLatest([
dohTabs$,
dolTabs$,
fshTabs$
]).subscribe(([dohTabs, dolTabs, fshTabs]) => {
const finalLogTrackingData = [
...dohTabs,
...dolTabs
];
this.downloadFile('log-tracker-page-data.json', finalLogTrackingData);
this.downloadFile('fishing-log-tracker-page-data.json', fshTabs);
res$.next();
});
return res$;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
public doCollectablesData(): Observable<LazyDataWithExtracts['collectablesPageData']> {
this.running = true;
this.currentLabel = 'Collectables page data';
const res$ = new ReplaySubject<LazyDataWithExtracts['collectablesPageData']>();
this.lazyData.preloadEntry('paramGrow');
const jobs = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
this.totalTodo$.next(jobs.length);
this.done$.next(0);
safeCombineLatest(jobs.map((job) => {
return this.getCollectables(job).pipe(
map(groups => {
this.done$.next(this.done$.value + 1);
return { job, groups };
})
);
})).subscribe(collectablesPageData => {
const indexed = collectablesPageData.reduce((acc, { job, groups }) => {
return {
...acc,
[job]: groups
};
}, {});
this.downloadFile('collectables-page-data.json', indexed);
res$.next(indexed);
});
return res$;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
public doExtracts(): Observable<LazyDataWithExtracts['extracts']> {
this.running = true;
this.currentLabel = 'Extracts';
const res$ = new ReplaySubject<LazyDataWithExtracts['extracts']>();
this.lazyData.getEntry('items').pipe(
switchMap(lazyItems => {
const chunks = _.chunk(Object.keys(lazyItems), 100);
this.totalTodo$.next(chunks.length);
return requestsWithDelay(chunks.map(itemIds => {
return this.http.get<any[]>(`https://www.garlandtools.org/db/doc/item/en/3/${itemIds.join(',')}.json`).pipe(
map(items => this.serializer.deserialize<ItemData>(items.filter(i => !i.error).map(item => item.obj), [ItemData])),
switchMap((items: ItemData[]) => {
if (items.length === 0) {
return of([]);
}
return combineLatest(items.map(data => {
const item: any = {
id: data.item.id
};
return this.extractor.addDataToItem(item, data).pipe(
map(extract => {
delete extract.yield;
delete extract.requires;
delete extract.workingOnIt;
return extract;
})
);
})).pipe(
first()
);
}),
tap(() => {
this.done$.next(this.done$.value + 1);
})
);
}), 200);
})
).subscribe(items => {
const extracts = [].concat.apply([], items).reduce((acc, i) => {
acc[i.id] = i;
return acc;
}, {});
this.downloadFile('extracts.json', extracts);
res$.next(extracts);
});
return res$;
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
private getCollectables(jobId: number): Observable<any[]> {
return combineLatest([
this.lazyData.getEntry('collectables'),
this.lazyData.getEntry('collectablesShops')
]).pipe(
switchMap(([collectables, collectablesShops]) => {
return combineLatest(Object.keys(collectables)
.filter(key => {
const collectableEntry = collectables[key];
if (collectableEntry.hwd || !collectableEntry.collectable) {
return false;
}
const job = Object.keys(collectablesShops).find(sKey => {
return collectablesShops[sKey].includes(collectableEntry.shopId);
});
return job !== undefined && (+job + 8) === jobId;
})
.map(key => {
return {
...collectables[key],
itemId: +key,
amount: 1
};
})
.reduce((acc, row) => {
let group = acc.find(accRow => accRow.groupId === row.group);
if (group === undefined) {
acc.push({
groupId: row.group,
collectables: []
});
group = acc[acc.length - 1];
}
group.collectables.push(row);
return acc;
}, [])
.map(group => {
return safeCombineLatest(group.collectables
.sort((a, b) => b.levelMax - a.levelMax)
.map(collectable => {
return combineLatest([
this.getExp(collectable, collectable.base.exp),
this.getExp(collectable, collectable.mid.exp),
this.getExp(collectable, collectable.high.exp)
]).pipe(
switchMap(([expBase, expMid, expHigh]) => {
collectable.expBase = expBase;
collectable.expMid = expMid;
collectable.expHigh = expHigh;
if ([16, 17, 18].includes(jobId)) {
return this.gatheringNodesService.getItemNodes(collectable.itemId, true).pipe(
map(nodes => {
collectable.nodes = nodes.map(gatheringNode => {
return {
gatheringNode,
alarms: gatheringNode.limited ? this.alarmsFacade.generateAlarms(gatheringNode) : []
};
});
return collectable;
})
);
}
return of(collectable);
})
);
})
).pipe(
map(res => {
group.collectables = res;
return group;
})
);
})
);
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
private getExp(collectable: any, ratio: number): Observable<number[]> {
return combineLatest(new Array(environment.maxLevel).fill(null).map((ignored, index) => {
const level = index + 1;
const firstCollectableDigit = Math.floor(collectable.levelMax / 10);
const firstLevelDigit = Math.floor(level / 10);
let nerfedExp = firstCollectableDigit < firstLevelDigit;
if (level % 10 === 0 && level > collectable.levelMax) {
nerfedExp = nerfedExp && (firstCollectableDigit + 1) < firstLevelDigit
|| (level - collectable.levelMax) >= 10
|| collectable.levelMax % 10 === 0;
}
if (nerfedExp) {
return of(10000);
}
return this.lazyData.getRow('paramGrow', collectable.levelMax).pipe(
map(row => row.ExpToNext * ratio / 1000)
);
})).pipe(
map(expArray => expArray.filter(v => v !== 10000))
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
private getFshData(itemId: number, spotId: number): Observable<{ gatheringNode: GatheringNode, alarms: Alarm[] }[]> {
return this.gatheringNodesService.getItemNodes(itemId, true)
.pipe(
map(nodes => {
return uniqBy(nodes.filter(node => node.id === spotId)
.map(node => {
return {
gatheringNode: node,
alarms: this.alarmsFacade.generateAlarms(node)
};
}), entry => entry.gatheringNode.baits && entry.gatheringNode.baits[0])
.slice(0, 3);
})
);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
MethodDeclaration |
private downloadFile(filename: string, data: any): void {
const blob = new Blob([JSON.stringify(data)], { type: 'text/plain;charset:utf-8' });
saveAs(blob, filename);
} | Ra-Workspace/ffxiv-teamcraft | apps/client/src/app/pages/extractor/extractor/extractor.component.ts | TypeScript |
ArrowFunction |
() => {
return (
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>Redux icon</title>
<path d="M16.633 16.504c.869-.075 1.543-.84 1.499-1.754-.046-.914-.795-1.648-1.708-1.648h-.061c-.943.031-1.678.824-1.648 1.769.03.479.226.869.494 1.153-1.048 2.038-2.621 3.536-5.004 4.795-1.603.838-3.296 1.154-4.944.929-1.378-.194-2.456-.81-3.116-1.798-.988-1.499-1.078-3.116-.255-4.734.601-1.169 1.499-2.023 2.099-2.443-.15-.389-.33-1.048-.42-1.542-4.436 3.177-3.985 7.521-2.637 9.574 1.004 1.498 3.057 2.456 5.304 2.456.599 0 1.229-.044 1.843-.194 3.896-.749 6.847-3.086 8.54-6.532l.014-.031zM21.981 12.758c-2.321-2.727-5.738-4.225-9.634-4.225h-.51c-.253-.554-.837-.899-1.497-.899h-.045c-.943 0-1.678.81-1.647 1.753.03.898.794 1.648 1.708 1.648h.074c.675-.03 1.259-.45 1.498-1.049h.555c2.309 0 4.495.674 6.488 1.992 1.527 1.004 2.622 2.322 3.236 3.896.538 1.288.509 2.547-.045 3.597-.854 1.647-2.293 2.517-4.195 2.517-1.199 0-2.367-.375-2.967-.644-.359.298-.959.793-1.394 1.093 1.318.598 2.652.943 3.94.943 2.922 0 5.093-1.647 5.918-3.236.898-1.798.824-4.824-1.469-7.416l-.014.03zM6.49 17.042c.029.899.793 1.648 1.708 1.648h.06c.959-.03 1.693-.823 1.648-1.768 0-.899-.779-1.647-1.693-1.647h-.061c-.06 0-.149 0-.225.029-1.243-2.098-1.768-4.346-1.572-6.771.119-1.828.719-3.417 1.797-4.735.899-1.124 2.592-1.679 3.746-1.708 3.236-.061 4.585 3.971 4.689 5.574l1.498.449c-.345-4.914-3.4-7.492-6.322-7.492-2.742 0-5.273 1.993-6.293 4.915-1.393 3.896-.479 7.641 1.229 10.638-.149.195-.239.539-.209.868z" />
</svg> | grantmontgomery/grantcreates2.0 | src/components/Icons/Redux.tsx | TypeScript |
InterfaceDeclaration |
export interface GlobalProp extends ColorProp, FontProp {
} | mocoolka/mocoolka-doc | lib/src/examples/colorType.d.ts | TypeScript |
InterfaceDeclaration |
export interface ColorProp {
color: 'accent' | 'alert' | 'alt' | 'disabled' | 'main' | 'primary' | 'secondary' | 'success' | 'warning' | 'hint' | 'inherit';
bgColor: 'paper' | 'content' | 'divider' | 'accent' | 'alert' | 'alt' | 'disabled' | 'main' | 'selected' | 'focus' | 'success' | 'warning' | 'transparent' | 'inherit';
} | mocoolka/mocoolka-doc | lib/src/examples/colorType.d.ts | TypeScript |
InterfaceDeclaration |
export interface FontProp {
fontWeight: 'thin' | 'light' | 'regular' | 'medium' | 'bold' | 'black' | 'inherit';
fontFamily: 'sansSerif' | 'serif' | 'monospace' | 'inherit';
fontSize: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle' | 'p' | 'caption' | 'overline' | 'inherit';
} | mocoolka/mocoolka-doc | lib/src/examples/colorType.d.ts | TypeScript |
ArrowFunction |
(theme: Theme) => ({
paper: {
padding: theme.spacing(3),
paddingBottom: theme.spacing(3),
marginBottom: theme.spacing(3)
}
}) | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |
ArrowFunction |
props => {
const classes = useStyles();
const { updateProfile, requestProfile } = useProfile();
const { profile, _isRestrictedUser } = useAccountManagement();
const timezone = useTimezone();
const loggedInAsCustomer = useSelector(
(state: ApplicationState) => state.authentication.loggedInAsCustomer
);
const location = useLocation();
const emailRef = React.createRef<HTMLInputElement>();
React.useEffect(() => {
if (location.state?.focusEmail && emailRef.current) {
emailRef.current.focus();
emailRef.current.scrollIntoView();
}
}, [emailRef, location.state]);
// Used as React keys to force-rerender forms.
const [emailResetToken, setEmailResetToken] = React.useState(v4());
const [usernameResetToken, setUsernameResetToken] = React.useState(v4());
const [timezoneResetToken, setTimezoneResetToken] = React.useState(v4());
const updateUsername = (newUsername: string) => {
setEmailResetToken(v4());
setTimezoneResetToken(v4());
// Default to empty string... but I don't believe this is possible.
return updateUser(profile?.data?.username ?? '', {
username: newUsername
});
};
const updateEmail = (newEmail: string) => {
setUsernameResetToken(v4());
setTimezoneResetToken(v4());
return updateProfile({ email: newEmail });
};
const updateTimezone = (newTimezone: string) => {
setUsernameResetToken(v4());
setEmailResetToken(v4());
return updateProfile({ timezone: newTimezone });
};
return (
<>
<Paper className={classes.paper}>
<SingleTextFieldForm
key={usernameResetToken}
label="Username"
submitForm={updateUsername}
initialValue={profile?.data?.username}
disabled={_isRestrictedUser}
tooltipText={
_isRestrictedUser
? 'Restricted users cannot update their username. Please contact an account administrator.'
: undefined
}
successCallback={requestProfile}
/>
</Paper>
<Paper className={classes.paper}>
<SingleTextFieldForm
key={emailResetToken}
label="Email"
submitForm={updateEmail}
initialValue={profile?.data?.email}
successCallback={() | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |
ArrowFunction |
(state: ApplicationState) => state.authentication.loggedInAsCustomer | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |
ArrowFunction |
() => {
if (location.state?.focusEmail && emailRef.current) {
emailRef.current.focus();
emailRef.current.scrollIntoView();
}
} | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |
ArrowFunction |
(newUsername: string) => {
setEmailResetToken(v4());
setTimezoneResetToken(v4());
// Default to empty string... but I don't believe this is possible.
return updateUser(profile?.data?.username ?? '', {
username: newUsername
});
} | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |
ArrowFunction |
(newEmail: string) => {
setUsernameResetToken(v4());
setTimezoneResetToken(v4());
return updateProfile({ email: newEmail });
} | Jskobos/manager | packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx | TypeScript |