A look at a couple translations reflecting modern and classic scholarship offers some helpful insight.
24 The best thing we can do is to enjoy eating, drinking, and
working.[a] I believe these are God’s gifts to us, 25 and no one
enjoys eating and living more than I do. 26 If we please God, he will
make us wise, understanding, and happy. But if we sin, God will make
us struggle for a living, then he will give all we own to someone who
pleases him. This makes no more sense than chasing the wind.[b]CEV
24 There is nothing good in a man who eateth, and hath drunk, and hath
shewn his soul good in his labour. This also I have seen that it [is]
from the hand of God.
25 For who eateth and who hasteth out more than I?
26 For to a man who [is] good before Him, He hath given wisdom, and
knowledge, and joy; and to a sinner He hath given travail, to gather
and to heap up, to give to the good before God. Even this [is] vanity
and vexation of spirit.(Young's Literal Translation--YLT)
the word translated "work" means task, work, labor; misfortune, cares, troubles: It is also translated "travail" (Strongs H6045). The translators above understood this to be hard work.
I am taken by this back to the garden when Adam and Eve sinned and God pronounced judgement on them:
17 Then to Adam He said, "Because you have heeded the voice of your wife, and have eaten from the tree of which I commanded you, saying, 'You shall not eat of it':
" Cursed is the ground for your sake;
In toil you shall eat of it
All the days of your life.
18 Both thorns and thistles it shall bring forth for you,
And you shall eat the herb of the field.
19 In the sweat of your face you shall eat bread
Till you return to the ground,
For out of it you were taken;
For dust you are,
And to dust you shall return."
Contrast that with the word of the LORD to Joshuah 24:13 about Israel inhabiting the land:
13 I gave you a land on which you had not labored
and cities that you had not built, and you dwell in them.
You eat the fruit of vineyards and olive orchards that you did not plant.’
Now, consider the passage in Ecclesiastes through the lens of Psalm 1:
1 Blessed is the man
Who walks not in the counsel of the ungodly,
Nor stands in the path of sinners,
Nor sits in the seat of the scornful;
2 But his delight is in the law of the LORD,
And in His law he meditates day and night.
3 He shall be like a tree
Planted by the rivers of water,
That brings forth its fruit in its season,
Whose leaf also shall not wither;
And whatever he does shall prosper.
4 The ungodly are not so,
But are like the chaff which the wind drives away.
5 Therefore the ungodly shall not stand in the judgment,
Nor sinners in the congregation of the righteous.
6 For the LORD knows the way of the righteous,
But the way of the ungodly shall perish.
It is not a matter of what kind of work we are doing, but of whether that work is blessed, that is addressed in this passage. If we walk in the instruction of the LORD we will be blessed in whatever we do. If we walk in sin, we will work hard for nothing. It will be vanity.