Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 215-change-content-of-operation-card
  • 216-create-table-for-operations
  • 249-404-not-found-after-choosing-an-account-from-search-bar-with-enter
  • 366-allow-env-level-configuration-of-default-site-colors-for-both-light-and-dark-modes
  • 504-incorrect-weight_threshold-indications-for-hive-fund-steem-dao-accounts
  • adubel/fix-skiped-tests
  • adubel/test-e2e-fix-locators
  • adubel/test-improvements
  • bw_format_msg_tweaks
  • copy_of_add_charts_to_balance_history
  • delrifai/#356_calculate_hive_power_for_voters_and_votes_history
  • delrifai/#372_fix_pagination_issues
  • delrifai/#384_add_scroll_left_right_to_table
  • delrifai/#394_add_charts_to_balance_history
  • delrifai/#433_add_noResult_component
  • delrifai/#505_fix_no_filter_balance_history
  • delrifai/all_blocks_fixes_1
  • develop
  • jlachor/healthchecker
  • jlachor/local-healthchecker
  • jlachor/virtual-in-raw
  • kbotor/80-configure-ssl-for-staging-and-test-deployments
  • kbotor/cors-fix
  • lbudginas/#240_transaction_link_scroll
  • lbudginas/#276_pretty_json_operation_view
  • lbudginas/#287_witness_table_update
  • lbudginas/#304_convert_vests_to_hp_account_page
  • lbudginas/#374_calendar_dates_selection_bug
  • lbudginas/#385_single_post_page
  • lbudginas/#390_auto_suggest_bg_bug
  • lbudginas/#396_account_operations_table_bug
  • lbudginas/#439_account_page_request_optimisation
  • lbudginas/#443_post_page_links_bug
  • lbudginas/#447_post_dollar_value_not_visible
  • lbudginas/#523_tooltips_on_mobile
  • lbudginas/account_page_votes_history
  • lbudginas/aggregate_operations_block_page
  • lbudginas/clear_storage_on_invalid_api_address
  • lbudginas/refactor_url_param_build
  • lbudginas/replace-date-time-pickers-shadcn-ui
  • master
  • mcfarhat-283-add_live_profile_tracking
  • mcfarhat-283-live_profile_tracking_updates
  • mcfarhat-285-add_vesting_delegations
  • mcfarhat-295-witness_page_feed_age
  • mcfarhat-301-hide_disabled_witnesses
  • mcfarhat-302-fix_crash_user_profile
  • mcfarhat-316-fix_issue_with_delegated_values_wallet
  • mcfarhat-332-fix_update_date_picker
  • mcfarhat-fix_delegated_values_display
  • test-tag
51 results

Target

Select target project
  • hive/block_explorer_ui
1 result
Select Git revision
  • 215-change-content-of-operation-card
  • 216-create-table-for-operations
  • 249-404-not-found-after-choosing-an-account-from-search-bar-with-enter
  • 366-allow-env-level-configuration-of-default-site-colors-for-both-light-and-dark-modes
  • 504-incorrect-weight_threshold-indications-for-hive-fund-steem-dao-accounts
  • adubel/fix-skiped-tests
  • adubel/test-e2e-fix-locators
  • adubel/test-improvements
  • bw_format_msg_tweaks
  • copy_of_add_charts_to_balance_history
  • delrifai/#356_calculate_hive_power_for_voters_and_votes_history
  • delrifai/#372_fix_pagination_issues
  • delrifai/#384_add_scroll_left_right_to_table
  • delrifai/#394_add_charts_to_balance_history
  • delrifai/#433_add_noResult_component
  • delrifai/#505_fix_no_filter_balance_history
  • delrifai/all_blocks_fixes_1
  • develop
  • jlachor/healthchecker
  • jlachor/local-healthchecker
  • jlachor/virtual-in-raw
  • kbotor/80-configure-ssl-for-staging-and-test-deployments
  • kbotor/cors-fix
  • lbudginas/#240_transaction_link_scroll
  • lbudginas/#276_pretty_json_operation_view
  • lbudginas/#287_witness_table_update
  • lbudginas/#304_convert_vests_to_hp_account_page
  • lbudginas/#374_calendar_dates_selection_bug
  • lbudginas/#385_single_post_page
  • lbudginas/#390_auto_suggest_bg_bug
  • lbudginas/#396_account_operations_table_bug
  • lbudginas/#439_account_page_request_optimisation
  • lbudginas/#443_post_page_links_bug
  • lbudginas/#447_post_dollar_value_not_visible
  • lbudginas/#523_tooltips_on_mobile
  • lbudginas/account_page_votes_history
  • lbudginas/aggregate_operations_block_page
  • lbudginas/clear_storage_on_invalid_api_address
  • lbudginas/refactor_url_param_build
  • lbudginas/replace-date-time-pickers-shadcn-ui
  • master
  • mcfarhat-283-add_live_profile_tracking
  • mcfarhat-283-live_profile_tracking_updates
  • mcfarhat-285-add_vesting_delegations
  • mcfarhat-295-witness_page_feed_age
  • mcfarhat-301-hide_disabled_witnesses
  • mcfarhat-302-fix_crash_user_profile
  • mcfarhat-316-fix_issue_with_delegated_values_wallet
  • mcfarhat-332-fix_update_date_picker
  • mcfarhat-fix_delegated_values_display
  • test-tag
51 results
Show changes
Commits on Source (5)
......@@ -12,8 +12,8 @@ import CopyButton from "../ui/CopyButton";
interface BlockDetailsProps {
virtualOperationsTypesCounters?: Explorer.OperationCounter[];
nonVirtualOperationsTypesCounters?: Explorer.OperationCounter[];
virtualOperationLength: number;
nonVirtualOperationLength: number;
virtualOperationLength: number | undefined;
nonVirtualOperationLength: number | undefined;
blockDetails?: Hive.BlockDetails;
enableRawVirtualOperations: boolean;
handleEnableVirtualOperations: () => void;
......
......@@ -8,8 +8,8 @@ import { useUserSettingsContext } from "@/contexts/UserSettingsContext";
interface BlockPageOperationCountProps {
virtualOperationsTypesCounters?: Explorer.OperationCounter[];
nonVirtualOperationsTypesCounters?: Explorer.OperationCounter[];
virtualOperationLength: number;
nonVirtualOperationLength: number;
virtualOperationLength: number | undefined;
nonVirtualOperationLength: number | undefined;
enableRawVirtualOperations: boolean;
handleEnableVirtualOperations: () => void;
}
......
......@@ -39,6 +39,23 @@ const MONTHS = [
const WEEK_DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const sanitizeTimeValue = (rawValue: string, max: number): string => {
let clean = rawValue.replace(/\D/g, "");
if (clean.length > 2) {
clean = clean.slice(0, 2);
}
if (clean === "") return "";
let num = parseInt(clean, 10);
if (num < 0) num = 0;
if (num > max) num = max;
return String(num);
};
const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
value,
onChange,
......@@ -46,76 +63,87 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
onClose,
isValidDate,
}) => {
const [internalValue, setInternalValue] = useState(value || new Date());
const [internalDate, setInternalDate] = useState<Date>(value || new Date());
const [hourStr, setHourStr] = useState(String(value.getUTCHours()));
const [minuteStr, setMinuteStr] = useState(String(value.getUTCMinutes()));
const [secondStr, setSecondStr] = useState(String(value.getUTCSeconds()));
const [currentMonth, setCurrentMonth] = useState(
value ? new Date(value) : new Date()
);
const [showYearMonthPicker, setShowYearMonthPicker] = useState(false);
const [tempYear, setTempYear] = useState((value || new Date()).getFullYear());
const containerRef: React.MutableRefObject<null | any> = useRef(null);
const [tempYear, setTempYear] = useState(currentMonth.getFullYear());
const containerRef = useRef<HTMLDivElement | null>(null);
useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
const handleClickOutside = (e: MouseEvent) => {
if (
containerRef.current &&
event.target instanceof Node &&
!containerRef.current.contains(event.target)
e.target instanceof Node &&
!containerRef.current.contains(e.target)
) {
setShowYearMonthPicker(false);
}
};
document.addEventListener("mousedown", handleClickOutside);
return () => document.removeEventListener("mousedown", handleClickOutside);
}, []);
const handleLocalTimeChange = (
type: "hours" | "minutes" | "seconds",
val: string
) => {
if (type === "hours") {
setHourStr(sanitizeTimeValue(val, 23));
} else if (type === "minutes") {
setMinuteStr(sanitizeTimeValue(val, 59));
} else if (type === "seconds") {
setSecondStr(sanitizeTimeValue(val, 59));
}
};
const handleDateClick = (day: Date) => {
if (isValidDate && !isValidDate(day)) return;
const hours = internalValue.getUTCHours();
const minutes = internalValue.getUTCMinutes();
const seconds = internalValue.getUTCSeconds();
const hours = parseInt(hourStr, 10) || 0;
const minutes = parseInt(minuteStr, 10) || 0;
const seconds = parseInt(secondStr, 10) || 0;
const updatedDate = new Date(
Date.UTC(
day.getFullYear(),
day.getMonth(),
day.getDate(),
hours,
minutes,
seconds
)
day.getFullYear(),
day.getMonth(),
day.getDate(),
hours,
minutes,
seconds
);
setInternalValue(updatedDate);
setInternalDate(updatedDate);
};
const handleMonthChange = (direction: any) => {
const handleMonthChange = (direction: number) => {
setCurrentMonth(addMonths(currentMonth, direction));
};
const handleTimeChange = (type: any, newValue: any) => {
const updatedDate = new Date(internalValue.getTime());
if (type === "hours") {
updatedDate.setUTCHours(
parseInt(newValue, 10),
updatedDate.getUTCMinutes(),
updatedDate.getUTCSeconds()
);
} else if (type === "minutes") {
updatedDate.setUTCMinutes(
parseInt(newValue, 10),
updatedDate.getUTCSeconds()
);
} else if (type === "seconds") {
updatedDate.setUTCSeconds(parseInt(newValue, 10));
}
const handleConfirm = () => {
const h = parseInt(hourStr, 10) || 0;
const m = parseInt(minuteStr, 10) || 0;
const s = parseInt(secondStr, 10) || 0;
setInternalValue(updatedDate);
};
const hours = Math.max(0, Math.min(h, 23));
const minutes = Math.max(0, Math.min(m, 59));
const seconds = Math.max(0, Math.min(s, 59));
const handleConfirm = () => {
onChange(internalValue);
const finalDate = new Date(
Date.UTC(
internalDate.getFullYear(),
internalDate.getMonth(),
internalDate.getDate(),
hours,
minutes,
seconds
)
);
onChange(finalDate);
setShowYearMonthPicker(false);
onClose();
};
......@@ -126,18 +154,16 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
const startDate = startOfWeek(monthStart, { weekStartsOn: 0 });
const endDate = endOfWeek(monthEnd, { weekStartsOn: 0 });
const dayFormat = "d";
const rows = [];
let days = [];
let days: JSX.Element[] = [];
let day = startDate;
while (day <= endDate) {
const weekStart = day;
for (let i = 0; i < 7; i++) {
const cloneDay = day;
const formattedDate = format(day, dayFormat);
const isSelectedDay = isSameDay(cloneDay, internalValue);
const inCurrentMonth = isSameMonth(cloneDay, monthStart);
const isSelectedDay = isSameDay(cloneDay, internalDate);
const dayIsValid = !isValidDate || isValidDate(cloneDay);
const disabledClass = !inCurrentMonth ? "not-same-month" : "";
......@@ -150,7 +176,7 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
key={cloneDay.toISOString()}
onClick={() => handleDateClick(cloneDay)}
>
<span>{formattedDate}</span>
<span>{format(day, "d")}</span>
</div>
);
day = addDays(day, 1);
......@@ -170,11 +196,11 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
return <div className="calendar-body">{rows}</div>;
};
const handleYearChange = (e: any) => {
const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setTempYear(parseInt(e.target.value, 10));
};
const handleMonthSelect = (monthIndex: any) => {
const handleMonthSelect = (monthIndex: number) => {
const updatedMonth = setYear(
setMonth(new Date(currentMonth), monthIndex),
tempYear
......@@ -183,14 +209,13 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
setShowYearMonthPicker(false);
};
const hours = internalValue.getUTCHours();
const minutes = internalValue.getUTCMinutes();
const seconds = internalValue.getUTCSeconds();
return (
<>
{open && (
<div className="datetime-popover">
<div
ref={containerRef}
className="datetime-popover"
>
{!showYearMonthPicker && (
<>
<div className="calendar-header">
......@@ -233,36 +258,30 @@ const CustomDateTimePicker: React.FC<CustomDateTimePickerProps> = ({
<div className="time-field">
<label>Hours</label>
<input
type="number"
min="0"
max="23"
value={hours}
type="text"
value={hourStr}
onChange={(e) =>
handleTimeChange("hours", e.target.value)
handleLocalTimeChange("hours", e.target.value)
}
/>
</div>
<div className="time-field">
<label>Minutes</label>
<input
type="number"
min="0"
max="59"
value={minutes}
type="text"
value={minuteStr}
onChange={(e) =>
handleTimeChange("minutes", e.target.value)
handleLocalTimeChange("minutes", e.target.value)
}
/>
</div>
<div className="time-field">
<label>Seconds</label>
<input
type="number"
min="0"
max="59"
value={seconds}
type="text"
value={secondStr}
onChange={(e) =>
handleTimeChange("seconds", e.target.value)
handleLocalTimeChange("seconds", e.target.value)
}
/>
</div>
......
......@@ -90,14 +90,14 @@ export default function Block() {
const { settings } = useUserSettingsContext();
const { operationsCountInBlock, countLoading } =
useOperationsCountInBlock(blockId);
const { blockDetails, loading } = useBlockData(blockId);
const { blockDetails, loading } = useBlockData(blockId);
const { rawBlockdata } = useBlockRawData(blockId, enableRawVirtualOperations);
const { blockOperations: totalOperations, trxLoading: totalLoading } =
useBlockOperations(blockId, undefined, paramsState.page || 1);
/* Calculating Maximum Transaction in Blog */
let maxTransactions = 0;
let maxTransactions = undefined;
if (
totalOperations?.operations_result &&
Array.isArray(totalOperations.operations_result)
......@@ -112,8 +112,9 @@ export default function Block() {
},
0
);
maxTransactions += 1; // Add one since trx_in_block starts at 0 an not 1
}
maxTransactions += 1; // Add one since trx_in_block starts at 0 an not 1
const { blockError, blockOperations, trxLoading } = useBlockOperations(
blockId,
......@@ -147,6 +148,15 @@ export default function Block() {
);
const getOperationsCounts = useCallback(() => {
if(countLoading)
{
return {
virtualOperationsCounter: undefined,
nonVirtualOperationsCounter: undefined,
virtualOperationsTypesCounters: [],
nonVirtualOperationsTypesCounters: [],
};
}
if (operationsCountInBlock && !countLoading && operationsTypes) {
const virtualOperationsTypesCounters: Explorer.OperationCounter[] = [];
const nonVirtualOperationsTypesCounters: Explorer.OperationCounter[] = [];
......