diff --git a/typing-app/public/texts/test.txt b/typing-app/public/texts/test.txt
deleted file mode 100644
index 3467cae..0000000
--- a/typing-app/public/texts/test.txt
+++ /dev/null
@@ -1,5 +0,0 @@
- It is April 2002, and I am visiting Tokuro Takei’s comfortably sunlit Japanese/Western-style home in Hamamatsu, Japan for the first time. His wife meets me at the door with a deep bow, which I return with one of my own before handing over a gift-wrapped box of rice crackers and offering a stock Japanese apology for imposing myself like this. Mrs. Takei receives my gift with another bow and, as etiquette dictates, politely refuses to acknowledge my need to apologize. I remove my shoes in the ground-level foyer and step up on to the raised floor of the house in my stocking feet. Mrs. Takei offers me the customary house slippers a visitor to a Japanese house will typically wear. I decline the offer on the valid grounds that my feet are too big for the slippers, and we share a quick if bashful laugh over this footwear conundrum while she shows me to the living room sofa.
- When not in motion plying me with green tea and cookies while we wait for her husband to come to the living room, Mrs. Takei stands a few steps behind the sofa and just out of my field of vision. I can sense her nervousness, and am not sure if her taciturnity stems from fear and shyness or from her assuming that a language barrier will make any attempts at meaningful conversation a mutually embarrassing exercise in frustration. Accordingly, neither of us says anything. I sit on the Takeis’ sofa looking at naval citations on the wall and plastic models of Zero fighters lined up on the bookshelves while Mrs. Takei maintains her vigil safely out of sight.
- The cultural dynamic of silence at work here – which I have encountered thousands of times during my Japanese sojourn – is not particularly uncomfortable for me (although it may be for Takei-san, uninitiated as she is to visits from international men of mystery). Over the years, I have lost my quintessentially American fear of conversational lulls longer than a few seconds, so this particular silence does not faze me. Nevertheless, I am beginning to feel a tad guilty over Takei-san’s obvious discomfort, so I decide to try to put my hostess at ease with a little demonstration of Japanese language ability. Etiquette gives me an in here – it will not be untoward for me to apologize once again for my rude intrusion (under the rules of Japanese etiquette you can never truly apologize too much for anything). The tit-for-tat torrent of stock platitudes my apology will trigger can be found virtually word for word in any basic Japanese conversation textbook, but then again, sometimes clichés can be reassuring, and I suppose this has as good a chance of breaking some ice as anything else. (459 words)
-
-出典:Sheftall, M.G. (2005[2023]). Blossoms in the Wind: Human Legacies of the Kamikaze (pp113-114). New York: Dutton Books.
diff --git a/typing-app/public/texts/test2.txt b/typing-app/public/texts/test2.txt
deleted file mode 100644
index a6b2dce..0000000
--- a/typing-app/public/texts/test2.txt
+++ /dev/null
@@ -1 +0,0 @@
-As the night falls and silence covers everything, in my dream I become an adventurer. I crossed far-off mountains, explored unknown forests and interacted with various creatures I met along the way. Sometimes making friendships, sometimes overcoming ordeals, I am breath taken by the fantastic landscapes that I can only see in my dreams. Although the destinations are always changing, the experience of travelling enriches my mind and adds a new colour to my days in the real world.
\ No newline at end of file
diff --git a/typing-app/public/texts/test3.txt b/typing-app/public/texts/test3.txt
deleted file mode 100644
index 37df419..0000000
--- a/typing-app/public/texts/test3.txt
+++ /dev/null
@@ -1 +0,0 @@
-In 2050, our lives have changed in ways we cannot even imagine. At home, AI assists with daily tasks and transport is supported by fully automated vehicles. At work, virtual reality has replaced meeting rooms, enabling real-time collaboration even in remote locations. At the heart of all this technology, however, is the human spirit of connection. The technologies of the future exist to enhance humanity and enrich our lives.
\ No newline at end of file
diff --git a/typing-app/public/texts/test4.txt b/typing-app/public/texts/test4.txt
deleted file mode 100644
index 0d78240..0000000
--- a/typing-app/public/texts/test4.txt
+++ /dev/null
@@ -1 +0,0 @@
-Throughout the year, the change of seasons always brings fresh surprises. The arrival of spring melts away the cold of winter and brings flowers into bloom. Summer gives energy to activities in the sunshine, and autumn signals the end of the year through the carpet of fallen leaves. And when winter arrives, the serenity of snow envelops everything. Each season has its own unique beauty and rhythm of life.
\ No newline at end of file
diff --git a/typing-app/public/texts/test5.txt b/typing-app/public/texts/test5.txt
deleted file mode 100644
index d1960db..0000000
--- a/typing-app/public/texts/test5.txt
+++ /dev/null
@@ -1 +0,0 @@
-Brewing a cup of tea in the afternoon is a special moment to get away from the busyness of everyday life and calm down. As the hot tea is poured into the cup, the warm steam fills the air and the subtle aroma soothes the soul. Through this quiet time, you face yourself and temporarily escape from the hustle and bustle of everyday life. Tea time is not just a rest, but a ritual for self-renewal.
\ No newline at end of file
diff --git a/typing-app/src/app/game/page.tsx b/typing-app/src/app/game/page.tsx
index 3308b9a..ecaa917 100644
--- a/typing-app/src/app/game/page.tsx
+++ b/typing-app/src/app/game/page.tsx
@@ -1,9 +1,12 @@
import GamePage from "@/components/pages/Game";
import fs from "fs";
-import path from "path";
export default function Typing() {
- const textsDirectory = path.join(process.cwd(), "public/texts");
- const filenames = fs.readdirSync(textsDirectory).filter((filename) => filename.endsWith(".txt"));
- return ;
+ const filenames = fs.readdirSync("src/assets/texts/");
+ const subjectText = fs.readFileSync(
+ `src/assets/texts/${filenames[Math.floor(Math.random() * filenames.length)]}`,
+ "utf-8"
+ );
+
+ return ;
}
diff --git a/typing-app/src/assets/texts/text4.txt b/typing-app/src/assets/texts/text4.txt
new file mode 100644
index 0000000..ab6baa0
--- /dev/null
+++ b/typing-app/src/assets/texts/text4.txt
@@ -0,0 +1,29 @@
+Fellow–Citizens of the Senate and House of Representatives:
+
+I embrace with great satisfaction the opportunity which now presents itself of congratulating you on the present favorable prospects of our public affairs. The recent accession of the important state of north Carolina to the Constitution of the United States (of which official information has been received), the rising credit and respectability of our country, the general and increasing good will toward the government of the Union, and the concord, peace, and plenty with which we are blessed are circumstances auspicious in an eminent degree to our national prosperity.
+In resuming your consultations for the general good you can not but derive encouragement from the reflection that the measures of the last session have been as satisfactory to your constituents as the novelty and difficulty of the work allowed you to hope. Still further to realize their expectations and to secure the blessings which a gracious Providence has placed within our reach will in the course of the present important session call for the cool and deliberate exertion of your patriotism, firmness, and wisdom.
+Among the many interesting objects which will engage your attention that of providing for the common defense will merit particular regard. To be prepared for war is on e of the most effectual means of preserving peace.
+A free people ought not only to be armed, but disciplined; to which end a uniform and well–digested plan is requisite; and their safety and interest require that they should promote such manufactories as tend to render them independent of others for essential, particularly military, supplies.
+The proper establishment of the troops which may be deemed indispensable will be entitled to mature consideration. In the arrangements which may be made respecting it it will be of importance to conciliate the comfortable support of the officers and soldiers with a due regard to economy.
+There was reason to hope that the pacific measures adopted with regard to certain hostile tribes of Indians would have relieved the inhabitants of our southern and western frontiers from their depredations, but you will perceive from the information contained in the papers which I shall direct to be laid before you (comprehending a communication from the Commonwealth of Virginia) that we ought to be prepared to afford protection to those parts of the Union, and, if necessary, to punish aggressors.
+The interests of the United States require that our intercourse with other nations should be facilitated by such provisions as will enable me to fulfill my duty in that respect in the manner which circumstances may render most conducive to the public good, and to this end that the compensation to be made to the persons who may be employed should, according to the nature of their appointments, be defined by law, and a competent fund designated for defraying the expenses incident to the conduct of foreign affairs.
+Various considerations also render it expedient that the terms on which foreigners may be admitted to the rights of citizens should be speedily ascertained by a uniform rule of naturalization.
+Uniformity in the currency, weights, and measures of the United States is an object of great importance, and will, I am persuaded, be duly attended to.
+The advancement of agriculture, commerce, and manufactures by all proper means will not, I trust, need recommendation; but I can not forbear intimating to you the expediency of giving effectual encouragement as well to the introduction of new and useful inventions from abroad as to the exertions of skill and genius in producing them at home, and of facilitating the intercourse between the distant parts of our country by a due attention to the post–office and post–roads.
+Nor am I less persuaded that you will agree with me in opinion that there is nothing which can better deserve your patronage than the promotion of science and literature. Knowledge is in every country the surest basis of public happiness. In one in which the measures of government receive their impressions so immediately from the sense of the community as in ours it is proportionably essential.
+To the security of a free constitution it contributes in various ways – by convincing those who are intrusted with the public administration that every valuable end of government is best answered by the enlightened confidence of the people, and by teaching the people themselves to know and to value their own rights; to discern and provide against invasions of them; to distinguish between oppression and the necessary exercise of lawful authority; between burthens proceeding from a disregard to their convenience and those resulting from the inevitable exigencies of society; to discriminate the spirit of liberty from that of licentiousness – cherishing the first, avoiding the last – and uniting a speedy but temperate vigilance against encroachments, with an inviolable respect to the laws.
+Whether this desirable object will be best promoted by affording aids to seminaries of learning already established, by the institution of a national university, or by any other expedients will be well worthy of a place in the deliberations of the legislature.
+Gentlemen of the House of Representatives:
+I saw with peculiar pleasure at the close of the last session the resolution entered into by you expressive of your opinion that an adequate provision for the support of the public credit is a matter of high importance to the national honor and prosperity. In this sentiment I entirely concur; and to a perfect confidence in your best endeavors to devise such a provision as will be truly with the end I add an equal reliance on the cheerful cooperation of the other branch of the legislature.
+It would be superfluous to specify inducements to a measure in which the character and interests of the United States are so obviously so deeply concerned, and which has received so explicit a sanction from your declaration.
+
+Gentlemen of the Senate and House of Representatives:
+
+I have directed the proper officers to lay before you, respectively, such papers and estimates as regard the affairs particularly recommended to your consideration, and necessary to convey to you that information of the state of the Union which it is my duty to afford.
+
+The welfare of our country is the great object to which our cares and efforts ought to be directed, and I shall derive great satisfaction from a cooperation with you in the pleasing though arduous task of insuring to our fellow citizens the blessings which they have a right to expect from a free, efficient, and equal government.
+
+GEORGE WASHINGTON
+
+ANNUAL MESSAGE TO CONGRESS, JANUARY 8, 1790
+(from https://etc.usf.edu/lit2go/132/presidential-addresses-and-messages/4925/annual-message-to-congress-january-8-1790/)
diff --git a/typing-app/src/assets/texts/text5.txt b/typing-app/src/assets/texts/text5.txt
new file mode 100644
index 0000000..1f0abe7
--- /dev/null
+++ b/typing-app/src/assets/texts/text5.txt
@@ -0,0 +1,19 @@
+Friends and Fellow Citizens:
+
+Called upon to undertake the duties of the first executive office of our country, I avail myself of the presence of that portion of my fellow–citizens which is here assembled to express my grateful thanks for the favor with which they have been pleased to look toward me, to declare a sincere consciousness that the task is above my talents, and that I approach it with those anxious and awful presentiments which the greatness of the charge and the weakness of my powers so justly inspire. A rising nation, spread over a wide and fruitful land, traversing all the seas with the rich productions of their industry, engaged in commerce with nations who feel power and forget right, advancing rapidly to destinies beyond the reach of mortal eye—when I contemplate these transcendent objects, and see the honor, the happiness, and the hopes of this beloved country committed to the issue and the auspices of this day, I shrink from the contemplation, and humble myself before the magnitude of the undertaking. Utterly, indeed, should I despair did not the presence of many whom I here see remind me that in the other high authorities provided by our I shall find resources of wisdom, of virtue, and of zeal on which to rely under all difficulties. To you, then, gentlemen, who are charged with the sovereign functions of legislation, and to those associated with you, I look with encouragement for that guidance and support which may enable us to steer with safety the vessel in which we are all embarked amidst the conflicting elements of a troubled world.
+
+During the contest of opinion through which we have passed the animation of discussions and of exertions has sometimes worn an aspect which might impose on strangers unused to think freely and to speak and to write what they think; but this being now decided by the voice of the nation, announced according to the rules of the, all will, of course, arrange themselves under the will of the law, and unite in common efforts for the common good. All, too, will bear in mind this sacred principle, that though the will of the majority is in all cases to prevail, that will to be rightful must be reasonable; that the minority possess their equal rights, which equal law must protect, and to violate would be oppression. Let us, then, fellow–citizens, unite with one heart and one mind. Let us restore to social intercourse that harmony and affection without which liberty and even life itself are but dreary things. And let us reflect that, having banished from our land that religious intolerance under which mankind so long bled and suffered, we have yet gained little if we countenance a political intolerance as despotic, as wicked, and capable of as bitter and bloody persecutions. During the throes and convulsions of the ancient world, during the agonizing spasms of infuriated man, seeking through blood and slaughter his long–lost liberty, it was not wonderful that the agitation of the billows should reach even this distant and peaceful shore; that this should be more felt and feared by some and less by others, and should divide opinions as to measures of safety. But every difference of opinion is not a difference of principle. We have called by different names brethren of the same principle. We are all Republicans, we are all Federalists. If there be any among us who would wish to dissolve this Union or to change its republican form, let them stand undisturbed as monuments of the safety with which error of opinion may be tolerated where reason is left free to combat it. I know, indeed, that some honest men fear that a republican government can not be strong, that this Government is not strong enough; but would the honest patriot, in the full tide of successful experiment, abandon a government which has so far kept us free and firm on the theoretic and visionary fear that this Government, the world's best hope, may by possibility want energy to preserve itself? I trust not. I believe this, on the contrary, the strongest Government on earth. I believe it the only one where every man, at the call of the law, would fly to the standard of the law, and would meet invasions of the public order as his own personal concern. Sometimes it is said that man can not be trusted with the government of himself. Can he, then, be trusted with the government of others? Or have we found angels in the forms of kings to govern him? Let history answer this question.
+
+Let us, then, with courage and confidence pursue our own Federal and Republican principles, our attachment to union and representative government. Kindly separated by nature and a wide ocean from the exterminating havoc of one quarter of the globe; too high–minded to endure the degradations of the others; possessing a chosen country, with room enough for our descendants to the thousandth and thousandth generation; entertaining a due sense of our equal right to the use of our own faculties, to the acquisitions of our own industry, to honor and confidence from our fellow–citizens, resulting not from birth, but from our actions and their sense of them; enlightened by a benign religion, professed, indeed, and practiced in various forms, yet all of them inculcating honesty, truth, temperance, gratitude, and the love of man; acknowledging and adoring an overruling Providence, which by all its dispensations proves that it delights in the happiness of man here and his greater happiness hereafter—with all these blessings, what more is necessary to make us a happy and a prosperous people? Still one thing more, fellow–citizens—a wise and frugal Government, which shall restrain men from injuring one another, shall leave them otherwise free to regulate their own pursuits of industry and improvement, and shall not take from the mouth of labor the bread it has earned. This is the sum of good government, and this is necessary to close the circle of our felicities.
+
+About to enter, fellow–citizens, on the exercise of duties which comprehend everything dear and valuable to you, it is proper you should understand what I deem the essential principles of our Government, and consequently those which ought to shape its Administration. I will compress them within the narrowest compass they will bear, stating the general principle, but not all its limitations. Equal and exact justice to all men, of whatever state or persuasion, religious or political; peace, commerce, and honest friendship with all nations, entangling alliances with none; the support of the State governments in all their rights, as the most competent administrations for our domestic concerns and the surest bulwarks against antirepublican tendencies; the preservation of the General Government in its whole constitutional vigor, as the sheet anchor of our peace at home and safety abroad; a jealous care of the right of election by the people—a mild and safe corrective of abuses which are lopped by the sword of revolution where peaceable remedies are unprovided; absolute acquiescence in the decisions of the majority, the vital principle of republics, from which is no appeal but to force, the vital principle and immediate parent of despotism; a well–disciplined militia, our best reliance in peace and for the first moments of war till regulars may relieve them; the supremacy of the civil over the military authority; economy in the public expense, that labor may be lightly burthened; the honest payment of our debts and sacred preservation of the public faith; encouragement of agriculture, and of commerce as its handmaid; the diffusion of information and arraignment of all abuses at the bar of the public reason; freedom of religion; freedom of the press, and freedom of person under the protection of the habeas corpus, and trial by juries impartially selected. These principles form the bright constellation which has gone before us and guided our steps through an age of revolution and reformation. The wisdom of our sages and blood of our heroes have been devoted to their attainment. They should be the creed of our political faith, the text of civic instruction, the touchstone by which to try the services of those we trust; and should we wander from them in moments of error or of alarm, let us hasten to retrace our steps and to regain the road which alone leads to peace, liberty, and safety.
+
+I repair, then, fellow–citizens, to the post you have assigned me. With experience enough in subordinate offices to have seen the difficulties of this the greatest of all, I have learnt to expect that it will rarely fall to the lot of imperfect man to retire from this station with the reputation and the favor which bring him into it. Without pretensions to that high confidence you reposed in our first and greatest revolutionary character, whose preeminent services had entitled him to the first place in his country's love and destined for him the fairest page in the volume of faithful history, I ask so much confidence only as may give firmness and effect to the legal administration of your affairs. I shall often go wrong through defect of judgment. When right, I shall often be thought wrong by those whose positions will not command a view of the whole ground. I ask your indulgence for my own errors, which will never be intentional, and your support against the errors of others, who may condemn what they would not if seen in all its parts. The approbation implied by your suffrage is a great consolation to me for the past, and my future solicitude will be to retain the good opinion of those who have bestowed it in advance, to conciliate that of others by doing them all the good in my power, and to be instrumental to the happiness and freedom of all.
+
+Relying, then, on the patronage of your good will, I advance with obedience to the work, ready to retire from it whenever you become sensible how much better choice it is in your power to make. And may that Infinite Power which rules the destinies of the universe lead our councils to what is best, and give them a favorable issue for your peace and prosperity.
+
+Thomas Jefferson
+
+
+FIRST INAUGURAL ADDRESS, WASHINGTON, D.C., MARCH 4, 1801
+(from https://etc.usf.edu/lit2go/132/presidential-addresses-and-messages/5163/first-inaugural-address-washington-dc-march-4-1801/)
diff --git a/typing-app/src/assets/texts/text6.txt b/typing-app/src/assets/texts/text6.txt
new file mode 100644
index 0000000..172b16a
--- /dev/null
+++ b/typing-app/src/assets/texts/text6.txt
@@ -0,0 +1,16 @@
+Well, children, where there is so much racket there must be something out of kilter. I think that ‘twixt the Negroes of the South and the women at the North, all talking about rights, the white men will be in a fix pretty soon. But what’s all this here talking about?
+
+That man over there says that women need to be helped into carriages, and lifted over ditches, and to have the best place everywhere. Nobody ever helps me into carriages, or over mud-puddles, or gives me any best place! And ain’t I a woman? Look at me! Look at my arm! I have ploughed and planted, and gathered into barns, and no man could head me! And ain’t I a woman? I could work as much and eat as much as a man – when I could get it – and bear the lash as well! And ain’t I a woman? I have borne thirteen children, and seen most all sold off to slavery, and when I cried out with my mother’s grief, none but Jesus heard me! And ain’t I a woman?
+
+Then they talk about this thing in the head; what’s this they call it? [member of audience whispers, “intellect”] That’s it, honey. What’s that got to do with women’s rights or Negroes’ rights? If my cup won’t hold but a pint, and yours holds a quart, wouldn’t you be mean not to let me have my little half measure full?
+
+Then that little man in black there, he says women can’t have as much rights as men, ‘cause Christ wasn’t a woman! Where did your Christ come from? Where did your Christ come from? From God and a woman! Man had nothing to do with Him.
+
+If the first woman God ever made was strong enough to turn the world upside down all alone, these women together ought to be able to turn it back, and get it right side up again! And now they is asking to do it. The men better let them.
+
+Obliged to you for hearing me, and now old Sojourner ain’t got nothing more to say.
+
+AIN'T I A WOMAN?
+Sojourner Truth
+
+(from https://etc.usf.edu/lit2go/185/civil-rights-and-conflict-in-the-united-states-selected-speeches/3089/aint-i-a-woman/)
diff --git a/typing-app/src/components/pages/Game.tsx b/typing-app/src/components/pages/Game.tsx
index 3592022..6a7a5a2 100644
--- a/typing-app/src/components/pages/Game.tsx
+++ b/typing-app/src/components/pages/Game.tsx
@@ -12,16 +12,16 @@ export interface GamePreProps {
export interface GameTypingProps {
nextPage: () => void;
- filenames: string[];
+ subjectText: string;
setResultScore: (data: ResultScore) => void;
screenIndex: number;
}
interface GamePageProps {
- filenames: string[];
+ subjectText: string;
}
-const GamePage: React.FC = ({ filenames }) => {
+const GamePage: React.FC = ({ subjectText }) => {
const ScreenIndex = {
IDX_PRE: 0,
IDX_TYPING: 1,
@@ -45,7 +45,7 @@ const GamePage: React.FC = ({ filenames }) => {
setScreenIndex(ScreenIndex.IDX_RESULT)}
- filenames={filenames}
+ subjectText={subjectText}
setResultScore={setResultScore}
screenIndex={screenIndex}
/>,
diff --git a/typing-app/src/components/templates/GameTyping.tsx b/typing-app/src/components/templates/GameTyping.tsx
index ec24bd8..244bd8b 100644
--- a/typing-app/src/components/templates/GameTyping.tsx
+++ b/typing-app/src/components/templates/GameTyping.tsx
@@ -10,31 +10,9 @@ import gaugePositionImg from "../../../public/img/gauge_position.png";
import gaugeSpeedImg from "../../../public/img/gauge_speed.png";
import gaugeTimeImg from "../../../public/img/gauge_time.png";
-const GameTyping: React.FC = ({ nextPage, filenames, setResultScore }) => {
- // subjectTextの状態を管理するuseStateフック
- const [subjectText, setSubjectText] = useState("");
+const GameTyping: React.FC = ({ nextPage, subjectText, setResultScore }) => {
const [startedAt, setStartedAt] = useState(new Date());
- useEffect(() => {
- const loadTextFile = async () => {
- // ランダムにファイル名を選択
- const randomFile = filenames[Math.floor(Math.random() * filenames.length)];
- // `public` ディレクトリからの相対パスを指定
- const filePath = `/texts/${randomFile}`;
- // fetch APIを使用してファイルの内容を読み込む
- try {
- const response = await fetch(filePath);
- const fetchedText = await response.text();
- setSubjectText(fetchedText); // レスポンスをsubjectTextステートに設定
- setStartedAt(new Date());
- } catch (error) {
- console.error("Error loading the text file:", error);
- }
- };
-
- loadTextFile();
- }, [filenames]); // ビルド時の警告防止のためにfilenamesを依存リストに追加
-
const totalSeconds = 60;
const [count, setCount] = useState(totalSeconds);
const damyUserId = "damyId";